fix: resolve template and frontmatter errors for hugo 0.123 compatibi…#497
fix: resolve template and frontmatter errors for hugo 0.123 compatibi…#497hemantch01 wants to merge 1 commit into
Conversation
…lity Signed-off-by: hemantch01 <hemantchaudhary905@gmail.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Welcome @hemantch01! It looks like this is your first PR to volcano-sh/website 🎉 |
There was a problem hiding this comment.
Code Review
This pull request updates Hugo template logic to use modern properties, such as hugo.Generator and .File.Dir, and standardizes blog post metadata by removing leading zeros from dates. It also configures syntax highlighting and improves RSS link generation. A significant regression was identified in the documentation sidebar where switching to section-based menu naming breaks navigation for versioned documentation; a suggestion was provided to derive the menu name from the file directory instead.
| @@ -1,5 +1,5 @@ | |||
| {{ $current_page := . }} | |||
| {{ $menu_name := (path.Base (path.Split .Path).Dir) }} | |||
| {{ $menu_name := .Section | default "docs" }} | |||
There was a problem hiding this comment.
The change from directory-based menu naming to .Section introduces a regression for versioned documentation. In this project, different versions of documentation are stored in subdirectories (e.g., content/en/docs/v1-7-0/) and rely on the directory name to identify their specific menu (e.g., [[menu.v1-7-0]]). By forcing $menu_name to .Section ("docs"), all versions will now attempt to load the same "docs" menu, which will break the sidebar navigation for versioned content.
To maintain the original logic while avoiding the deprecated .Path variable, you should derive the menu name from the file's directory with a fallback to the section name.
| {{ $menu_name := .Section | default "docs" }} | |
| {{ $menu_name := .Section }}{{ with .File }}{{ $menu_name = path.Base .Dir }}{{ end }} |
What kind of change does this PR introduce?
/kind bug
What this PR does / why we need it:
Upgrades the repository to compile successfully on modern versions of Hugo (v0.123+). Previously, attempting to run
hugo server -Don a modern compiler caused fatal crashes due to:dateday = 0X)..Hugo.Generator,.RSSLink,.Language.ContentDir,.UniqueID,.Dir).This PR patches all templates and blog posts to ensure new contributors can build the website locally.
Fixes [Bug] Website fails to build locally on modern Hugo versions (v0.123+) due to template deprecations and strict TOML parsing #496