How can i create a private post?

Not sure how private it has to be (Hugo creates RSS feeds, sitemap etc., so it will show up somewhere), but the easiest way is maybe to:

  1. Create a special section, i.e. a content root folder where you put this content, let us call it private (/content/private)
  2. Filter out that section in the where clause for the home page (in layouts/index.html):
{{ range where .Data.Pages "Section" "!=" "private" }}

See https://gohugo.io/templates/functions#where

1 Like