Usage
{{< item-group group = ".page.Pages.ByDate.Reverse" groupTags = "blog learn" [count = "3"] [skip = "1"] [scrClass = "ui image"] >}}Generic partial for rendering a list of page items from any pre-built group. Called by higher-level wrappers such as item-group-blog and item-group-by-type.
Description
Renders a paginated list of items from a caller-supplied page group. Each item displays a title, summary, reading-time estimate, and optional featured image. Tags are de-duplicated and sorted before being attached to each item. This partial is not usually called directly — use a wrapper partial that builds the group and tags first.
Parameters
indicates required parameter
group =
"collection"REQUIRED
Hugo page collection to iterate over (e.g. .page.Pages.ByDate.Reverse)
groupTags =
"string"REQUIRED
Space-separated tags applied to every item (duplicates are removed and sorted)
count =
"number"1
Number of items to display
skip =
"number"0
Number of items to skip from the front of the group before displaying
scrClass =
"string"
CSS classes applied to item images (note: parameter is scrClass, not srcClass)
page =
"object"REQUIREDcurrent page
Hugo page context (automatically provided by the calling partial)
Examples
item-group-blog — site-wide blog listing
{{- $group := (where .page.Site.RegularPages "Type" "blog").ByDate.Reverse -}}
{{- $groupTags := "blog" -}}
{{ $dot := merge . (dict "group" $group "groupTags" $groupTags) }}
{{partial "tool/item-group" $dot}}item-group-blog hard-codes the type filter to ‘blog’ and passes a fixed tag string
item-group-by-type — section children listing
{{- $group := .page.Pages.ByDate.Reverse -}}
{{- $groupTags := printf "%s" .page.Type | lower -}}
{{ $dot := merge . (dict "group" $group "groupTags" $groupTags) }}
{{partial "tool/item-group" $dot}}item-group-by-type uses direct children only (1 level deep) and derives the tag from the section type
Show 3 items, skipping the most recent
{{<hw t="item-group-blog" count="3" skip="1">}}skip=1 omits the featured/hero post so it can be shown separately above
Additional Information