but the partial lives in the layouts/ directory, which doesn’t allow translations.
Since the 404 page should have all the regular page variables available, I don’t see why I cannot add the content in a content file in the content/ directory.
Sorry, I thought I made myself clear. Here’s more explicitly what I am trying to do:
content/404.md:
---
page_title: "404. Sorry, the page was not found."
page_subtitle: "The page you are looking for doesn’t exists.<br>
Please check your URL address."
---
Am I missing anything? The above configuration does not work. When I navigate to localhost:1313/404.html I don’t see the title and subtitle of the 404 page.
That’s not how Hugo works. That’s not the problem. The problem is accessing the variables. The template works fine the way it’s configured. I can see the 404 page. I just cannot access the content of contents/404.md.
When I have the time to setup a dummy project in order to be able to share a link, I’ll do so. I was looking for a quick answer, in case I was doing something wrong. Since the solution is not so obvious, I’ll take the time to create a dummy project and update this ticket, in the future.
No need for a sample repo. I was able to reproduce. It seems that this is a case of a mix-up in the documentation. Although I am not 100% sure.
I have opened a GitHub issue in the Hugo Docs repo for you to follow. It includes a solution to your problem. See here:
P.S. The issue you encountered has nothing to do with the code snippets you posted above. Anyway I took the time to investigate further and not wait for your sample repo because I also have a multilingual project coming up and I needed to know what’s going on.