Hi, I am a beginner for Hugo. I already finish my list.html in layouts folder.
And then I create a single.html for my content.
But when I run “hugo server” and link to my content, it always display 404.
There is my code
What point I lose?
How do I solve it?
Thank you.
Is your <a>
tag well formed?
Maybe you need <a href="{{.URL}}"> {{.Title}} </a>
.
By the way @ZeYu_Hou, it’s better to use .Permalink
or .RelPermalink
, because .Page.URL
is marked for deprecation at some point.
Not solve…still print 404…
Ok, I had a few minutes to download your site and try it.
Just move your list.html
and single.html
into /layouts/_default
and it should work (this is what fixed the 404 for me).
Yeap, it fixed 404, but the {{.Content}} is empty now. I can’t show my content when I visit
“http://localhost:1313/daily02/”
Can you push your changes to github so we can see where things are up to? It’s hard to help when github still has your single.html
and list.html
not in the _default
folder.
Thank you. I push my folder again
You need to rename layouts/default
to layouts/_default
- the _ is important.
And now, when you run hugo server -D
you should see content at http://localhost:1313/daily01 etc. (You need the -D
flag to build draft and non-draft pages.)
Thank you, let me try again.