The post-index.html include file creates a straightforward, list-style layout for displaying collections of posts. It’s designed to present posts in a uniform, easy-to-scan format, ideal for archives, category listings, or any situation where a clean, consistent display is desired.
| Parameter | Default | Description |
|---|---|---|
collection |
Required | The collection of posts to display |
collection_permalink |
:name |
The permalink structure for individual collection pages |
replace_value |
:name |
The value to replace in the collection_permalink with the section slug |
per_section |
6 | Number of posts to display per section |
To use this include in your Jekyll site, you can call it from a layout or another include file like this:
{% include post-index.html
collection=site.categories
collection_permalink='/category/:name/'
replace_value=':name'
per_section=8
%}
The tag_index layout utilizes post-index.html to create a page that showcases posts with various tags.
To use the tag_index layout in a page:
---
layout: tag_index
title: Tags
---
To see post-index.html in action within the tag_index layout, visit our demo page:
per_section limit.post-card.html.This include depends on:
post-card.htmlYou can customize the appearance by modifying the HTML structure and CSS classes within the include file. The layout uses Primer css flex and grid classes, which can be adjusted to fit different design requirements.
post-card.html include is properly set up in your Jekyll site.collection_permalink and replace_value to generate the correct URL for each section.