Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hugo Posts not displaying

Tags:

go

hugo

toml

Using Hugo Quickstart, I was able to up and running set up a blog and even wrote a post. When I run either hugo server -D or hugo server -D --watch --verbose I can see my post on localhost. But when I run only hugo server my blog loads only the Title and no posts. I have generareted the necessary files using hugo server. What should I do such that when I run hugo server everything loads?

like image 874
Muli Avatar asked Aug 22 '18 20:08

Muli


1 Answers

In your content/posts/, look for the field draft in the front matter(should be at the top of every file in posts folder). The front matter should be similar to

title: "My First Post"

date: 2018-08-14T20:08:02+05:30

draft: true

Replace true with false for draft. Now run hugo server and check. You should be able to see your post now.

It seems by default, the posts that are being created in your content folder have draft set as true. hugo will not show these as web pages by default as these are drafts and not ready for publishing yet. To show these drafts you have to pass -D flag to hugo server, which is why you are able to see your posts on running this command.

If you want to set draft as false for every newly created post, you will have to set draft field in archetype/default.md as false.

like image 140
bornfree Avatar answered Nov 11 '22 01:11

bornfree