Expected Behavior
Internal links (e.g. a customMenus entry pointing to an internal page, or a
project card's .url pointing to an internal post) should resolve correctly
under any configured baseURL, including one with a subpath — e.g. a GitHub
Pages project site like https://user.github.io/repo/.
Current Behavior
These links are rendered as a raw, unprocessed href="{{ .url }}" with no
baseURL handling, so they only produce a correct path when baseURL has no
subpath. On a subpath deployment the link is missing the subpath entirely and
points to the wrong location — e.g. /posts instead of /repo/posts.
Two confirmed instances:
customMenus entries (navbar.html, footer.html)
- Project card links/buttons (
cards/project.html, .url) — the theme's own
exampleSite already demonstrates an internal-path use case for this field
(the "Rich Content" project in data/en/sections/projects.yaml), so this
isn't hypothetical.
Possible Solution
Distinguish internal (no http:///https:// prefix) from external URLs, and
resolve internal ones by joining them onto site.BaseURL | relLangURL (the
same pattern already used ad hoc for the blog/notes nav links).
Steps to Reproduce
- In
exampleSite, note the "Rich Content" project card in
data/en/sections/projects.yaml, which uses an internal url
(/posts/category/sub-category/rich-content/).
- Build with a subpath baseURL:
hugo --gc --minify --baseURL "https://example.com/subpath/"
- Inspect the rendered
href for that project card.
- Observe it renders as
/posts/category/sub-category/rich-content — missing
the /subpath prefix — while other internal links on the same page (e.g.
section anchors, the post's own card elsewhere via .RelPermalink) are
correctly prefixed with /subpath.
Screenshots
N/A — this is a server-rendered HTML output issue (wrong href value), not a
visual/layout bug.
Browsers Affected
N/A — the bug is in Hugo's build-time template rendering, not
browser-specific.
Detailed Description
Several href attributes in the theme are set directly from a data field
({{ .url }}) without passing through any Hugo URL-resolution function
(relLangURL, absLangURL, RelPermalink, etc.). This only happens to
produce a correct URL when baseURL has no subpath — on a project site or any
other non-root deployment, the link is simply wrong.
Expected Behavior
Internal links (e.g. a
customMenusentry pointing to an internal page, or aproject card's
.urlpointing to an internal post) should resolve correctlyunder any configured
baseURL, including one with a subpath — e.g. a GitHubPages project site like
https://user.github.io/repo/.Current Behavior
These links are rendered as a raw, unprocessed
href="{{ .url }}"with nobaseURL handling, so they only produce a correct path when
baseURLhas nosubpath. On a subpath deployment the link is missing the subpath entirely and
points to the wrong location — e.g.
/postsinstead of/repo/posts.Two confirmed instances:
customMenusentries (navbar.html,footer.html)cards/project.html,.url) — the theme's ownexampleSitealready demonstrates an internal-path use case for this field(the "Rich Content" project in
data/en/sections/projects.yaml), so thisisn't hypothetical.
Possible Solution
Distinguish internal (no
http:///https://prefix) from external URLs, andresolve internal ones by joining them onto
site.BaseURL | relLangURL(thesame pattern already used ad hoc for the blog/notes nav links).
Steps to Reproduce
exampleSite, note the "Rich Content" project card indata/en/sections/projects.yaml, which uses an internalurl(
/posts/category/sub-category/rich-content/).hugo --gc --minify --baseURL "https://example.com/subpath/"hreffor that project card./posts/category/sub-category/rich-content— missingthe
/subpathprefix — while other internal links on the same page (e.g.section anchors, the post's own card elsewhere via
.RelPermalink) arecorrectly prefixed with
/subpath.Screenshots
N/A — this is a server-rendered HTML output issue (wrong
hrefvalue), not avisual/layout bug.
Browsers Affected
N/A — the bug is in Hugo's build-time template rendering, not
browser-specific.
Detailed Description
Several
hrefattributes in the theme are set directly from a data field(
{{ .url }}) without passing through any Hugo URL-resolution function(
relLangURL,absLangURL,RelPermalink, etc.). This only happens toproduce a correct URL when
baseURLhas no subpath — on a project site or anyother non-root deployment, the link is simply wrong.