Freedom

List

·   1 min ·   Gautham Chettiar

Displays a simple list of posts with optional date display.

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

Parameters :

ParameterTypeDescriptionDefault
pageListPagesCollection of pages to displayrequired
showDatebooleanShow post datesfrom config
dateFormatstringDate format":date_medium"
listStylestringCSS list-style value"disc"
classstringAdditional CSS classes-
keystringConfig key for visibility"PostList"

Configuration :

yaml
params:
  showPostList: true                # Show/hide post list
  showPostListDate: true            # Show dates in list
  postListStyle: "disc"             # List bullet style ("disc", "circle", "square", "none")
  postListDateFormat: ":date_medium" # Default date format
  postListSortBy: "date"            # Sort by "date", "weight", or "title"
  postListSortOrder: "desc"         # Sort order "asc" or "desc"
  postListPaginate: true            # Enable pagination
  postListPageSize: 15              # Number of items per page

Examples :

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

// With dates
{{ partial "widgets/posts/list.html" (dict 
  "pageList" .Pages 
  "showDate" true
) }}

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

// Custom list style
{{ partial "widgets/posts/list.html" (dict 
  "pageList" .Pages 
  "listStyle" "square"
) }}

// No bullets
{{ partial "widgets/posts/list.html" (dict 
  "pageList" .Pages 
  "listStyle" "none"
) }}