I’m about to deploy my new hugo site. I have two blog posts ready to go. When I run hugo on my local computer in dev mode, both posts are listed on the home page. However, when I ran
hugo server -e production
to test what it would look like in production, hugo has created a home page with only a link to one of the two blog posts. I’m not sure if this is a theme level issue or a hugo issue.
I’m very limited in my choice of themes (I believe) because I couldn’t get CGO on my windows computer to build the themes that require it.
Any suggestions about how to get all blog posts listed on the home page?
Include a link to the source code repository of your project, because we really need the context of seeing your templates and partials to be able to help you. It is trivial to do a quick git clone on your repo, then run hugo server in your project, to help you out. On the other hand, recreating your code from screenshots, or sort of guessing at it, is not.
If you can’t share your repository for whatever reason, consider creating a dummy repo that you can share, which reproduces the problem you’re experiencing.
I only pushed that code to show you the blog. 1 hour ago it didn’t exist on github.com. I have the site on my local computer and never intended to push it to github until this problem arose.
to further illustrate, here’s a screenshot of the generated html of the blog post in the public folder, which I thought hugo only generated if draft was set to false.
I’m not sure how to make this any clearer. The draft flag does exactly what it is supposed to do, and its behavior in this context has not changed in a decade.
If your production site uses the “public” directory that you create locally, you should always clear the public directory before building to remove draft, expired, and deleted content.
If your site or theme has a static directory, even if it is empty, you can use the --cleanDestinationDir command line flag when building your site.