Skip to content
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

Not found resources in 404 page #1223

Closed
binick opened this issue May 23, 2023 · 6 comments
Closed

Not found resources in 404 page #1223

binick opened this issue May 23, 2023 · 6 comments
Labels
bug Something isn't working

Comments

@binick
Copy link
Contributor

binick commented May 23, 2023

Describe the bug
When navigating to a non-existent resource hugo will try to render the layout 404

Stylesheets are referenced with $stylesheet.RelPermalink.
This means that if the resource is at the path /foo/bar/my-resource.html then the stylesheet stylesheet{fingerprint}.css will also be looked up in /foo/bar/assets/css/stylesheet{fingerprint}.css while it is in /assets/css/stylesheet{fingerprint}.css.

  • Device/Os: [e.g. Android 10]
  • Type: [e.g. Desktop/Mobile]
  • Browser and version [e.g. Chrome 86.0]:
  • Hugo Version [ >=0.97.1 expected]:
  • Theme Version [e.g. v4.0, master, or commit-id ]:

Steps to reproduce the behavior:

  1. Add permelinks config:
permalinks:
  posts: /:year/:month/:day/:slug/
  1. Navigating to a non-existent resource

Expected behavior:
Resource files should always be loaded against the root

Repo/Source where this issue can be reproduced:
binick.github.io

@binick binick added the bug Something isn't working label May 23, 2023
@binick
Copy link
Contributor Author

binick commented May 23, 2023

I think just replace RelPermalink with Permalink in the assets definition

@adityatelange
Copy link
Owner

Hi @binick have you set baseURL?

@binick
Copy link
Contributor Author

binick commented Dec 23, 2023

Hi, yes. If you want, that is the src/config/production/config.yml

@adityatelange
Copy link
Owner

I don't know if it is related to gohugoio/hugo#8109, but there was no response from hugo team on this one #126

@adityatelange
Copy link
Owner

image
css resource loads fine?

@adityatelange
Copy link
Owner

adityatelange commented Dec 23, 2023

Not sure but seems like / in end (not being present) is the issue. https://gohugo.io/getting-started/configuration/#baseurl

(string) The absolute URL (protocol, host, path, and trailing slash) of your published site (e.g., https://www.example.org/docs/).

or try setting canonifyURLs to true https://gohugo.io/getting-started/configuration/#canonifyurls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants