Skip to content

Add --hugo-section-files-name flag for configurable index file output#455

Draft
klocke-io wants to merge 1 commit into
gardener:masterfrom
klocke-io:feat/configurable-section-files-name
Draft

Add --hugo-section-files-name flag for configurable index file output#455
klocke-io wants to merge 1 commit into
gardener:masterfrom
klocke-io:feat/configurable-section-files-name

Conversation

@klocke-io
Copy link
Copy Markdown
Member

Summary

  • Adds --hugo-section-files-name config option (default: _index.md) controlling the output filename when section files matching --hugo-section-files are renamed
  • Setting --hugo-section-files-name=index.md allows direct VitePress consumption without post-processing scripts that copy _index.mdindex.md
  • Replaces all hardcoded _index.md references across writer, link resolver, frontmatter, alias, docsy, and persona plugins
  • Resolves the existing TODO in HugoPrettyPath() to use IndexFileNames instead of hardcoded strings

Motivation

The SAP internal Gardener documentation is migrating from Hugo to VitePress. VitePress expects index.md while Docforge outputs _index.md (Hugo convention). Currently a post-processing script copies every _index.md to index.md after each Docforge run. This flag eliminates that workaround.

Config example

hugo-section-files-name: index.md

Test plan

  • go build ./... compiles successfully
  • All existing tests pass (except pre-existing anchor resolution failure on master)
  • Default value _index.md preserves backward compatibility
  • Integration test with VitePress documentation build

🤖 Generated with Claude Code

Add a new configuration option `--hugo-section-files-name` (default: `_index.md`)
that controls the output filename when section files are renamed. This allows
consumers using VitePress or other SSGs to set `--hugo-section-files-name=index.md`
instead of relying on post-processing scripts to copy `_index.md` to `index.md`.

The change replaces all hardcoded `_index.md` references with the configurable
value across the writer, link resolver, frontmatter computation, alias plugin,
docsy plugin, and persona plugin. Also resolves the existing TODO in
HugoPrettyPath() to use IndexFileNames instead of hardcoded strings.

Backward compatible: default value preserves existing behavior.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gardener-prow gardener-prow Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 23, 2026
@gardener-prow
Copy link
Copy Markdown

gardener-prow Bot commented Apr 23, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign kostov6 for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@gardener-prow gardener-prow Bot added do-not-merge/needs-kind Indicates a PR lacks a `kind/foo` label and requires one. cla: yes Indicates the PR's author has signed the cla-assistant.io CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Apr 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes Indicates the PR's author has signed the cla-assistant.io CLA. do-not-merge/needs-kind Indicates a PR lacks a `kind/foo` label and requires one. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant