Hi, I want to ask how to hide a page/post in Hugo? and still listed in sitemap.xml
.
I create a custom privacy policy page by creating a new post and I want to hide it in the main page, keep the page available in sitemap.
I tried to use hide: true
, draft: true
, and hidden: true
params in the post file, but it still doesn’t affect anything, the privacy policy is still listed in the main page.
I also tried moving around the privacy policy file, but it still doesn’t work. I tried to put it in content/
directory, content/page/
Information
Hugo Version: 0.98.0
Theme: PaperMod
Theme Version: 6.0
Hosting: Netlify
Link
My Website: https://ryanfaiz.netlify.app/
Source Code: GitHub - ryanfaiz/blog
Hi @Ryan21 ,
I spent quite some time on this, see this topic for a full overview , and this specific commit for the sitemap .
And, good news: I’ve been also using Papermod! (I’d be glad to get your feedback!)
1 Like
Hi @iaeiou ,
I have try your solution, and it was great solustion, but with one obstacle.
Your commit is not avaiable in PaperMod theme.
In the screenshot below it says “This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.”
So, I need to put manually in my theme configuration. But still, it was great solution.
Thank you.
I suspect some Github machinery here, glad you found your way around.
(Did you check the installation instructions in this post ?)
Side note: in retrospect, I’m not satisfied with the wording “offTheRecord”, and consider switching to something more sober, like “private: true
”.
lijn
May 19, 2022, 9:26am
5
If I understand correctly you want to exclude your privacy policy from the pages listed on the homepage.
I am not using Papermod, but I want to hide some pages from lists too. I use frontmatter to do this: ignore: true
And the my list definition has:
{{$p := where .RegularPages.ByDate "Params.ignore" "!=" true }}
So the full list definition looks like this:
{{define "main"}}
{{$p := where .RegularPages.ByDate "Params.ignore" "!=" true }}
{{$paginator := .Paginate $p}}
{{range $paginator.Pages }}
<p><a href="{{.RelPermalink}}">{{.Title}}</a></p>
<p>{{.PublishDate.Format "2 January 2006"}}</p>
{{end}}
{{template "_internal/pagination.html" .}}
{{end}}
1 Like
system
Closed
May 21, 2022, 9:27am
6
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.