summaryrefslogtreecommitdiff
path: root/archetypes
diff options
context:
space:
mode:
Diffstat (limited to 'archetypes')
-rw-r--r--archetypes/entry.md18
1 files changed, 16 insertions, 2 deletions
diff --git a/archetypes/entry.md b/archetypes/entry.md
index 32d6347..317c8b6 100644
--- a/archetypes/entry.md
+++ b/archetypes/entry.md
@@ -1,6 +1,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: {{ now.UTC.Format "2006-01-02T00:00:00Z" }}
-draft: true
+date: {{ $entryDate.Format "2006-01-02T15:04:05Z" }}
+draft: false
---