hextra icon indicating copy to clipboard operation
hextra copied to clipboard

feat: add ability to hide posts in blog overview

Open otherpaco opened this issue 2 years ago • 3 comments

I wanted to use the starting page as blog. But then all entries like "/about" or "/imprint" will show up as posts as they all are in the same folder content.

I added a param hideOnBlog to the front matter. That parameter will prevent the file from being listed in the blog overview but it is still accessible.

Here is a linkt to the code of a wip blog that shows what I want to achieve:

https://codeberg.org/otherpaco/p11io-hextra

otherpaco avatar Nov 23 '23 21:11 otherpaco

Deploy Preview for hugo-hextra ready!

Name Link
Latest commit 8a493c77df8737ecda187a8aa245a5b0201277e0
Latest deploy log https://app.netlify.com/sites/hugo-hextra/deploys/655fc921ca5726000837abee
Deploy Preview https://deploy-preview-219--hugo-hextra.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] avatar Nov 23 '23 21:11 netlify[bot]

Thank you, I like this idea. I will take a look

imfing avatar Nov 26 '23 12:11 imfing

Dear Xin, it realized there is much more to do and check to use the starting page as blog. I will keep on modifying my blog an will come back with a better PR or a feature request.

I removed the new parameter because I can simply use

{{- if eq .Params.type "blog" -}}

instead of

{{- if not .Params.hideOnBlog -}}

But there are more places I would need to add that e.g. layouts/partials/components/pager.html

Maybe it would be easier going with collections.Where gohugo docs

Feel free to close this PR and I could move the info to an issue if you prefer it that way.

Have a nice weekend

otherpaco avatar Dec 02 '23 15:12 otherpaco