Skip to content

Use index page titles for auto-generated section names#54

Open
shenxianpeng wants to merge 2 commits intomainfrom
feature/smart-section-titles
Open

Use index page titles for auto-generated section names#54
shenxianpeng wants to merge 2 commits intomainfrom
feature/smart-section-titles

Conversation

@shenxianpeng
Copy link
Copy Markdown
Member

@shenxianpeng shenxianpeng commented Apr 28, 2026

When the 'nav' configuration is not explicitly set, MkDocs generates navigation sections from directory names. This change updates those auto-generated section titles to use the index page's title instead of the raw directory name when an index page exists in the section.

For example, an 'about/' directory with 'about/index.md' whose title is 'About this Project' will now show 'About this Project' as the section name instead of 'about'.

This only applies after pages have been read/rendered (titles are resolved from metadata or headings), and only affects sections that contain an index page.

Fixes mkdocs/mkdocs#3356

Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Refactor / code cleanup
  • CI / build / dependency update
  • Other (describe below)

Checklist

  • New tests added for new behavior (if applicable)
  • Documentation updated (if applicable)
  • Release notes docs/about/release-notes.md updated (if applicable)

@github-actions github-actions Bot added the enhancement New feature or request label Apr 28, 2026
@shenxianpeng shenxianpeng added this to the v1.8.0 milestone Apr 28, 2026
@shenxianpeng shenxianpeng force-pushed the feature/smart-section-titles branch 2 times, most recently from c1cf5e7 to 25e22b9 Compare April 28, 2026 15:02
When the 'nav' configuration is not explicitly set, MkDocs generates
navigation sections from directory names. This change updates those
auto-generated section titles to use the index page's title instead
of the raw directory name when an index page exists in the section.

For example, an 'about/' directory with 'about/index.md' whose title
is 'About this Project' will now show 'About this Project' as the
section name instead of 'about'.

This only applies after pages have been read/rendered (titles are
resolved from metadata or headings), and only affects sections that
contain an index page.

Fixes #3656, #3356
@shenxianpeng shenxianpeng force-pushed the feature/smart-section-titles branch from 005c1fe to 5a048db Compare April 29, 2026 06:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

smart section titles when no navigation is configured

1 participant