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

Fix weird render on bad links, should go to 404 #24

Closed
CommunityUBC opened this issue Feb 20, 2024 · 3 comments
Closed

Fix weird render on bad links, should go to 404 #24

CommunityUBC opened this issue Feb 20, 2024 · 3 comments

Comments

@CommunityUBC
Copy link
Owner

CommunityUBC commented Feb 20, 2024

Works locally, but fails in prod

Potential useful threads:

@melwee01
Copy link

Can confirm that this happens on our site too for subpages (domain/page/subpage.html level), and only in production or static builds. Top-level pages don't throw a 404 either, but kick back to index.html. In dev, all of these would go to a 404 page.

In the case of dev, the stylesheet is loaded during the build from /assets/stylesheets, but prod is using asset/stylesheets and not finding the 404 for pages that aren't in the same subdirectory. We're not sure how to fix this.

@CommunityUBC
Copy link
Owner Author

Can confirm that this happens on our site too for subpages (domain/page/subpage.html level), and only in production or static builds. Top-level pages don't throw a 404 either, but kick back to index.html. In dev, all of these would go to a 404 page.

In the case of dev, the stylesheet is loaded during the build from /assets/stylesheets, but prod is using asset/stylesheets and not finding the 404 for pages that aren't in the same subdirectory. We're not sure how to fix this.

We were actually able to resolve this issue, but it took some trial and error and pushing to production. The format that worked was to use the URL of our live site (not GitHub pages URL), as well as the slash at the end:

site_url: https://ubcwiki.ca/

Here is the last commit: 652370f

Hope that works for you as well

@melwee01
Copy link

Yeah, that looks like ours (which still has the issue):

site_url: https://<domain>.com/

We don't publish through GitHub pages at all, only our live site.

Thanks, though. I'll check in with our deployment guys and see what they can dig up.

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

No branches or pull requests

2 participants