{{- /* featured.html (shortcode): Renders the latest post with `featured = true`. Target: _index.md Example: {{< featured TYPE="" >}} Params: - TYPE (string, optional): Visual style of the featured article. Values: banner, simple, plain. Default: plain Error handler: - warnf (To-do) - OCD (To-do) To-do: 1. Docs: https://alpha.oxypteros.com/docs/shortcodes/featured (Issue oxypteros/alpha-docs#1) 2. Add OCD error checks (Issue #1) Repo: https://github.com/oxypteros/alpha */ -}} {{- /* Case-insensitive parameter retrieval (default chaining) */}} {{- $type := .Get "TYPE" | default (.Get "Type") | default (.Get "type") | default "plain" }} {{- /* Allow case-insensitive matching*/}} {{- $type = lower $type }} {{- /* Retrieve featured post info */}} {{- $title := "" }} {{- $summary := "" }} {{- $link := "" }} {{- $dateMachine := "" }} {{- $modDateMachine := "" }} {{- range first 1 (where .Site.RegularPages.ByDate.Reverse ".Params.featured" true) }} {{- $title = .Page.Title }} {{- $summary = .Page.Summary }} {{- $link = .Page.RelPermalink }} {{- $dateMachine = or .Page.Date (now) | time.Format "2006-01-02T15:04:05-07:00" -}} {{- $modDateMachine = or .Page.Lastmod $dateMachine | time.Format "2006-01-02T15:04:05-07:00" -}} {{- end }} {{- /* Check if the post is updated */}} {{- $isUpdated := ne $modDateMachine $dateMachine -}} {{- if $isUpdated }} {{- $dateMachine = $modDateMachine }} {{- end }} {{- /* Shortcode Rendering */}} {{- if eq $type "banner" }}
{{- else if eq $type "simple" }}