Hi Itβs me again
So I am creating a site in Hugo which is technically a multisite. Two in one.
Both sites have a similar layout but different menus and content.
And create 404-specific layout templates (e.g. layouts/404.html) and use layout in frontmatter.
---
β¦
layout: 404
β¦
---
Or, to avoid the need for layout in frontmatter, put the error pages in an error-pages-404 section and create and error-pages-404 template.
It really depends on how you are hosting and what layout your hosting provider will support (and whether your hosting provider supports using different 404 pages for different parts of the same site).
I did see that but I am confused about it, on it they talk about multilingual sites, but in my case, the site is basically one. It just has a different nav for different page types. If you see the menu that I have shared. You know what I am doing it kinda work around.
Just ignore the fact it talks about multilingual. For the purposes of the redirect options what matters is that you have essentially two sites (one that is under /lang1 and another under /lang2), which is what you could have (only it is /site and /site-ijs).
If you want separate 404 pages, you likely have to restructure your site (I donβt think the 404 redirects have a regex or pattern option for choosing which pages to which to apply the 404: to quote from Netlify docs:
There are two limitations to be aware of when you use splats:
Itβs not possible to use an asterisk as a wildcard in the middle of a path, for example /jobs/*.html. You can only use asterisks at the end of the path segment, such as /jobs/*.
Itβs not possible to indicate a path to exclude from a splat redirect rule. Instead, we recommend that you take advantage of the rule processing order to set a more specific rule for the path that you want to exclude
Build the 404 pages for each language. The netlify or any other service is going to go up in the directory looking for the 404 page. For example if you have a 404 page in your blog directory and the error occur in that directory users will be shown the page blog/404.html if there is no such page the server is automatically going to move up in the directory.
content/
βββ en/
β βββ 404/
β βββ _index.md
βββ fr/
β βββ 404/
β βββ _index.md #this page be shown when user in the directory fr/
Just make sure to be sure to be sure to not forgot to add url: 404.html in your front matter.
okay so I created two 404.html files one of them in the root of main/404.html and other in rjis/404.html I also created a netlify.toml file and put this code in it.
[[redirects]]
from = "/main/*"
to = "/main/404.html"
status = 404
[[redirects]]
from = "/rjis/*"
to = "/rjis/404.html"
status = 404
why are you creating redirects? netlify will handle it automatically, not just netlify but also when you run hugo server the 404 will work make sure you follow the given steps or share a demo repo to help you pin point the exact isssue
The netlfy.toml file will only work for 404 pages on a live Netlify site (with Netlify that means a deploy preview site or your production site) not with hugo serve.