Excluding a category from the blog homepage

Nice! Thank you, @sod. Learnt a new thing. This should do what @pratik needs.

Replace line 2 in layouts/index.html with this code block that Sven shared. Place categories that you want to exclude in second line next to slice (for example, dev, tech in the example),

{{ $posts := where site.Pages "Type" "post" }}
{{ $hidden_posts := where $posts "Params.categories" "intersect" (slice "dev" "tech") }}
{{ $posts = $posts | symdiff $hidden_posts }}

I have tested this, works as expected.

3 Likes