Recently, when I was trying to generate my blog site using Hugo, I found that all my posts were successfully rendered, except for one new post. This was rather strange.

After some debugging, I found the culprit is the date format I use in the post front matter. I did not add the timezone info when I wrote the date info (only year, month, date, hour, minute, second were used). The date field info was like 2020-01-10 23:48:25. I added the timezone info to the date info: 2020-01-10 23:48:25+0800 and regenerated the blog site using Hugo. After that, the missing post was shown in the blog site. So we can conclude that the culprit is the incomplete date info.

# The cause（原因）

After pinpointing the issue, I searched the web and found the root cause. Whether a post will be rendered by Hugo depends on when this post will be published. If the publish time of a post is later than the time when we build the blog site, i.e., Hugo thinks that we want to publish this post in future time, then Hugo will not render this post by default. The post mentioned earlier is not rendered, because Hugo thinks we have not reached its publish date, so it skips rendering that post.

# Solution（解决方法）

To solve this problem, we need to force Hugo to render posts that have publish time in the future. We can fix this in two ways. First, add the following setting to config.toml:

buildFuture = true


The second way is to add option --buildFuture when we are using Hugo to build the blog site.