Skip to content

Commit b340621

Browse files
author
Zyna
committed
feat: add sorting according to startDate
1 parent 3fecdb6 commit b340621

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

content/post/_content.gotmpl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@
5656
{{/* Set "Posted on" date. */}}
5757
{{ $dates := dict "date" (time.AsTime .attributes.publishedAt) }}
5858

59+
{{/* Get sorting weight based on start date */}}
60+
{{ $startAt := time.AsTime .attributes.startAt }}
61+
{{ $weight := mul -1 $startAt.Unix }}
62+
5963
{{/* Add page. */}}
6064
{{ $page := dict
6165
"content" $content
@@ -64,6 +68,7 @@
6468
"params" $params
6569
"path" $path
6670
"title" $title
71+
"weight" $weight
6772
}}
6873

6974
{{ $.AddPage $page }}

0 commit comments

Comments
 (0)