I am using Jekyll to generate a static website. I currently display posts by category on their own pages using some simple liquid syntax:
{%- for post in site.categories.whatever -%}
{{ post.content }}
{%- endfor -%}
However, the posts are still generated independently (in /category/year/month/day/title.html
per the Jekyll defaults), which I don't need.
How can I prevent each post from generating its own independent HTML page while still being able to loop over site.categories
and include them in a page with multiple posts? Setting published: false
unfortunately prevents the posts from being added to site.categories
, which breaks the above for
loop. permalink: none
also has no apparent effect. Excluding the pages (via exclude: [xyzzy, plugh, ...]
in _config.yml
) does the same. A previous StackOverflow answer suggested setting the permalink to an existing page, but in Jekyll 3.6.2 this simply overwrites that page.
My current hack is to set the permalink for that category to /.trash
which is then easy to ignore when uploading the published site, but it seems like there ought to be a better way.