Draft Pages Still Display on Homepage Despite "draft: true"

Hi everyone,
I’m using Hugo to build my website and deploying it through GitHub Pages, but I have an issue where pages with draft: true are still appearing on the homepage.

It’s been 3 days and I haven’t found a solution, even though I’ve done everything chatgpt said
Here my Repo: GitHub - bitpaus7/bitpaus7.github.io

This line in your build workflow tells Hugo to build drafts… which results in drafts being… ehm… built :slight_smile:

Remove the --buildDrafts part.

2 Likes

Remove --buildDrafts from bitpaus7.github.io/.github/workflows/hugo.yaml at main · bitpaus7/bitpaus7.github.io · GitHub

And check if your prefered timezone matches your settings in bitpaus7.github.io/.github/workflows/hugo.yaml at main · bitpaus7/bitpaus7.github.io · GitHub

I updated my GitHub Actions workflow file I removed the --buildDrafts flag from the build command as recommended, and updated the TZ to Asia/Jakarta

now, when there is a draft: true my website becomes 404, but work fine when every posts draft: false

chatgpt said Modify the list.html file to ensure only articles with draft: false appear on the homepage and article list pages.

{{ range .Paginator.Pages }}
{{ if not .Params.draft }}
{{- partial “content/card.html” . -}}
{{ end }}
{{ end }}

  1. I would recommend to check your build actions and site publishing.

    You are running two workflows in parallel. One with Hugo and one with Jekyll. Guess you should have to disable one.
    when changing the deployment method, sometimes it’s necessary to unpublish the github pages site and republish it.

  2. When I visit https://bitpaus.com

    The draft (Buat Dompet Crypto") is still there
    I clicked some of the posts incl. the draft and did not get a 404.

  3. building locally using hugo server

    omits the draft and no 404
    with -Dincludes the draft and no 404.

You should handle 1. and try locally with a fresh run (no public dir, no resources dir) and see what happens.

If you still have problems, you will have to elaborate in more detail where you do what to reproduce the problem (and as recommended in 3. start locally.

its not 404, because i already switched to false again. when i download zip and run in local with

rm -rf .hugo_cache/ public/

hugo --buildDrafts --minify

hugo server

everything goes smoothly as I want, the page can be accessed but it doesn’t appear on the main page, and now im confused about how to update the repo, because I didn’t connect git, vscode, and terminal

mmh, how did you update your repo in the past?

git clone https://github.com/bitpaus7/bitpaus7.github.io
cd bitpaus7.github.io
### make your changes
git add "your changed files"
git commit -m "fancy commit"
git push

remember to check your workflows


and a hint:

looks like you use buildDraft to render a “secret” page and manually exclude it from listing. This in my opinion is misusing the draft feature. It’s not for hiding a present page when a site is published :wink:

have a look at the Build options | Hugo

and set that one in frontmatter to always render the page BUT make it invisible to any page collections

[build]
  list = 'never'
  render = 'always'