12

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?

andy
  • 1,947
  • 5
  • 27
  • 46

2 Answers2

28

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.

bornfree
  • 2,308
  • 1
  • 23
  • 33
  • 3
    This post actually helped on my main website, as I had forgotten to remove the draft boolean. Didn't know about the default.md thing though, might come in handy. – Pranav Sharma Aug 01 '19 at 11:12
0

Believe it or not: In my case, it did not work until I completely rebooted my machine. After that, the post was rendered. So maybe try this as well :-)

André Gasser
  • 1,065
  • 2
  • 14
  • 34