Skip to content

Header accessibility and configuration improvements#192

Open
crnh wants to merge 5 commits intotomfran:mainfrom
crnh:crnh/header-improvements
Open

Header accessibility and configuration improvements#192
crnh wants to merge 5 commits intotomfran:mainfrom
crnh:crnh/header-improvements

Conversation

@crnh
Copy link
Contributor

@crnh crnh commented Jan 17, 2026

Accessibility:

  • Use a nav element instead of a div
  • Add aria-current="page" attribute to the element of the current page

Configuration:

  • Compare item name with the .LinkTitle attribute instead of .Name. This allows to have a different title in the menu / URL than shown on the page. For example, I have a contact page which I want to show as '/contact' in the navigation and the URL, but the page's header shows 'Contact me!'. With this change, the navigation item will still be bold if you are on the contact page.
    • .LinkTitle defaults to .Title if not set. I tested if .Name is equal to .Title, and this appeared to be the case (.Name is also unset if the title is not set). I also couldn't find anything about the .Name method in the Hugo documentation.
  • The menu item's name is now also lowercased for comparison, so current page detection will also work for pages with an uppercase title.

crnh and others added 5 commits January 2, 2026 22:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant