-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] img icon in header only renders on landing page #622
Comments
label:
text: home
-- icon: img/logo-icon.svg
iconHeight: 35
label:
text: home
++ icon: /img/logo-icon.svg
iconHeight: 35 I hope this should solve the issue. |
How will this prevent the following request to be made |
It will replace the link with http://localhost:1313/img/logo-icon.svg which since the logo is in /static/img/logo-icon.svg is where the logo should be.
|
The leading slash resolves the issue as long as you have deployed the hugo website in the domain root. Otherwise, if the website is served from a subfolder you have to add the subfolder also in the icon path. baseURL: 'https://example.com/subfolder/'
params:
label:
icon: /subfolder/img/logo-icon.svg |
Hi - I think the answer to this is to use absURL something like:
That works for me for base URLs with and without subfolders. The suggestion above to add the subfolder in the icon path does work, but is inconvenient if you frequently want to change the subfolder (e.g. for deploying to a test site I specify a different baseURL using --baseURL on the hugo command line). Note that absURL will only keep the subfolder in https://example.com/subfolder/ if the icon path doesn't start with a slash (so use something like icon: img/logo-icon.svg rather than icon: /img/logo-icon.svg. Otherwise absURL will generate a URL from the server root (i.e. won't include the subfolder) |
Assume that you reference an image icon in
config.yaml
like so:It will only render on the landing page as relativeURL's are not used in the
header.html
partial:hugo-PaperMod/layouts/partials/header.html
Lines 49 to 50 in 3bcafa0
Therefore, you will end up looking for the file in the wrong location if you are on another site, as an example:
GET http://localhost:1313/posts/test/img/logo-icon.svg 404 (Not Found)
The text was updated successfully, but these errors were encountered: