The post-gallery.html include file creates a magazine-style layout for displaying groups of posts. It’s designed to showcase posts in a visually appealing manner, with the first post of each section displayed prominently and subsequent posts in a more compact format.
| Parameter | Default | Description |
|---|---|---|
sections |
Required | Grouped post sections to display |
section_permalink |
page.pagination.permalink |
The permalink structure for individual sections |
replace_value |
None | The value to replace in the section_permalink with the section slug |
per_section |
page.per_section or page.pagination.per_page |
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-gallery.html
sections=site.categories
section_permalink='/category/:name/'
replace_value=':name'
per_section=4
%}
This include is component-oriented: sections should be passed explicitly, while section_permalink and per_section can optionally fall back to page-level pagination values.
The category_index layout utilizes post-gallery.html to create a page that showcases posts from various categories.
To use the category_index layout in a page:
---
layout: category_index
title: Explore Our Categories
---
To see post-gallery.html in action within the category_index layout, visit our demo page:
post-tease-image-card.html.post-tease-text-card.html.sections is missing, the include renders nothing.This include depends on:
post-tease-image-card.htmlpost-tease-text-card.htmlYou can customize the appearance by modifying the HTML structure and CSS classes within the include file.
post-tease-image-card.html and post-tease-text-card.html includes are properly set up in your Jekyll site.{% cycle '', 'flex-row-reverse' %} tag alternates the layout direction for visual interest.section_permalink and replace_value to generate the correct URL for each section.