Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why my single page in Hugo returns a 404 HTTP error?

Tags:

hugo

I am trying to create a site with Hugo, but I don't get how to add a single page to my website (posts are working fine).

Starting from a fresh install (v.0.27 64x for windows) and running the following command from my terminal:

> hugo new site soexample
> cd soexample
> git clone https://github.com/parsiya/Hugo-Octopress.git themes\octopress
> hugo new about.md
> echo "Please display me" >> content\about.md
> hugo serve -D -t octopress

I can see that my draft page is rendered from the output of the last command:

...
Built site for language en:
1 of 1 draft rendered
...

but when I try to access either http://localhost:1313/about/ or http://localhost:1313/about.html, the server (not the browser) returns a white page with:

404 page not found

What am I missing ?

like image 779
Pierre-Jean Avatar asked Sep 14 '17 10:09

Pierre-Jean


Video Answer


1 Answers

The problem seems to come from the selected default theme that do not render single page outside of posts section. Themes can be a tricky point for beginners as hugo isn't shipped with default one and no official theme is recommended or supported (so beginners may have to choose randomly).

So the following commands worked for me:

> hugo new site soexample
> cd soexample
> git clone https://github.com/spf13/hyde.git themes\hyde
> hugo new about.md
> echo "Please display me" >> content\about.md
> hugo serve -D -t hyde

The page http://localhost:1313/about/ is correctly rendered.

like image 64
Pierre-Jean Avatar answered Mar 30 '23 05:03

Pierre-Jean