Date
Displays page date with optional icon and customizable format.
Location : layouts/_partials/widgets/meta/date.html
Parameters :
| Parameter | Type | Description | Default |
|---|---|---|---|
page | Page | Page context | required |
site | Site | Site context | required |
dateFormat | string | Go time format or Hugo date format | ":date_medium" |
class | string | Additional CSS classes | - |
key | string | Config key for visibility | "Date" |
Configuration :
yaml
params:
showDate: true # Show/hide date
showDateIcon: true # Show/hide date icon
dateType: "date" # Which date to show ("date", "publishdate", "lastmod", "expirydate")
dateFormat: ":date_long" # Global date formatExamples :
go
// Basic usage (uses :date_medium format)
{{ partial "widgets/meta/date.html" (dict "page" . "site" .Site) }}
// Custom format
{{ partial "widgets/meta/date.html" (dict
"page" .
"site" .Site
"dateFormat" "Jan 2, 2006"
) }}
// Hugo named format
{{ partial "widgets/meta/date.html" (dict
"page" .
"site" .Site
"dateFormat" ":date_long"
) }}
// With custom class
{{ partial "widgets/meta/date.html" (dict
"page" .
"site" .Site
"class" "post-date"
) }}