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?
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
.
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 :-)
© 2022 - 2024 — McMap. All rights reserved.