summaryrefslogtreecommitdiff
path: root/archetypes/entry.md
blob: 317c8b6169a9749c88f4d3c0cbb2d20d133ce5f955caf13a2813aa6da424ffe6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
---
{{ $today := now.UTC.Truncate (time.Duration "hour" 24) -}}
{{ $tomorrow := $today.Add (time.Duration "hour" 24) -}}

{{ $numSameDayEntries := len (where (where (where
  .Site.RegularPages.ByTitle "Section" "entry")
  "Date" "ge" $today)
  "Date" "lt" $tomorrow) -}}

{{ $entryDate := $today.Add (time.Duration "second" $numSameDayEntries) -}}

{{ if eq $entryDate $tomorrow -}}
  {{ errorf "Too many entries in one day!" }}
{{ end -}}

title: "{{ replace .Name "-" " " | title }}"
date: {{ $entryDate.Format "2006-01-02T15:04:05Z" }}
draft: false
---