freedom

Recents

Gautham Chettiar Est. 2 Mins ( 293 Words )

Render a list of the most recent pages from across the entire site using the widgets/recents.html partial.

Features#

Parameters#

count#
(optional) Maximum number of posts to show. Defaults to 5.
style#
(optional) List rendering style. One of "book", "card", or "simple". Defaults to "book".
class#
(optional) CSS class forwarded directly to the underlying list partial’s root element.

Syntax#

go-html-template
{{ partial "widgets/recents.html" (dict
    "count" 10
    "style" "book"
    "class" "optional-extra-class"
) }}

Examples#

Default (5 posts, book style)#

go-html-template
{{ partial "widgets/recents.html" . }}

Show 10 most recent posts using the card layout#

go-html-template
{{ partial "widgets/recents.html" (dict
    "count" 10
    "style" "card"
) }}

Show 3 most recent posts using the simple layout with a custom class#

go-html-template
{{ partial "widgets/recents.html" (dict
    "count" 3
    "style" "simple"
    "class" "sidebar-recents"
) }}

List Styles#

StyleDescription
bookFull-row anchor with a dotted leader between title and date. Great for indexes.
cardCover image, title, date, and summary displayed as a card grid.
simpleCompact inline format: date ›› title. Ideal for sidebars and footers.

Notes#