Freedom

Card

·   1 min ·   Gautham Chettiar

Displays posts in a responsive multi-column card grid with optional images, summaries, and dates.

Location : layouts/_partials/widgets/posts/card.html

Parameters :

ParameterTypeDescriptionDefault
pageListPagesCollection of pages to displayrequired
columnsnumberNumber of columns (1-4)3
showImagebooleanShow featured imagesfrom config
showSummarybooleanShow post summariesfrom config
showDatebooleanShow post datesfrom config
dateFormatstringDate format":date_medium"
classstringAdditional CSS classes-
keystringConfig key for visibility"PostCard"

Configuration :

yaml
params:
  showPostCard: false                # Use card layout (default: list)
  showPostCardImage: true            # Show featured images
  showPostCardSummary: true          # Show summaries
  showPostCardDate: true             # Show dates
  postCardColumns: 3                 # Number of columns (1-4)
  postCardDateFormat: ":date_medium" # Date format
  postCardSortBy: "date"             # Sort by "date", "weight", or "title"
  postCardSortOrder: "desc"          # Sort order "asc" or "desc"
  postCardPaginate: true             # Enable pagination
  postCardPageSize: 20               # Number of items per page

Examples :

go
// Basic usage (3 columns)
{{ partial "widgets/posts/card.html" (dict "pageList" .Pages) }}

// 2-column grid
{{ partial "widgets/posts/card.html" (dict 
  "pageList" .Pages 
  "columns" 2
) }}

// Without images
{{ partial "widgets/posts/card.html" (dict 
  "pageList" .Pages 
  "showImage" false
) }}

// Minimal cards (title only)
{{ partial "widgets/posts/card.html" (dict 
  "pageList" .Pages 
  "showImage" false
  "showSummary" false
  "showDate" false
) }}

// Custom date format
{{ partial "widgets/posts/card.html" (dict 
  "pageList" .Pages 
  "dateFormat" "Jan 2, 2006"
) }}