templates: add support for drafts
Anirudh Oppiliappan x@icyphox.sh
Sun, 08 Dec 2024 15:54:29 +0200
7 files changed,
26 insertions(+),
8 deletions(-)
M
bin/build.sh
→
bin/build.sh
@@ -4,4 +4,4 @@ rm -rf go-vite
git clone https://github.com/icyphox/go-vite cd go-vite && make && cd .. mkdir build -go-vite/vite build +go-vite/vite build --drafts
M
bin/serve.sh
→
bin/serve.sh
@@ -16,6 +16,6 @@ }
trap "kill_vite" INT "$vite" serve & -find pages/ static/ templates/ | entr "$vite" build +find pages/ static/ templates/ | entr "$vite" build --drafts trap SIGINT
M
flake.lock
→
flake.lock
@@ -2,11 +2,11 @@ {
"nodes": { "nixpkgs": { "locked": { - "lastModified": 1721833789, - "narHash": "sha256-VQw64O2UO0SnJlYiE9jvF9QVcFZgxvfiQxV2sKA20MU=", + "lastModified": 1731852624, + "narHash": "sha256-hfR6InYghPqZo5Lvojj6LqpJumh7G62oD0RN8VfBnkU=", "owner": "nixos", "repo": "nixpkgs", - "rev": "0e34403dab7f1171e0a2e4f5a47c32e7db95d0b2", + "rev": "8447f0f3e60462c5889a709af429b12b47c29ac5", "type": "github" }, "original": {@@ -41,11 +41,11 @@ "inputs": {
"nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1721802063, - "narHash": "sha256-rmfHh+td7P7vyg4t1XsGroNxeNDIlAGtFwMdWbvG/9A=", + "lastModified": 1731853533, + "narHash": "sha256-0KTyWOBy6Eub2hT3EN2Qri6l09vlxeg69XZlexwzl2s=", "owner": "icyphox", "repo": "go-vite", - "rev": "45310dfe7ecd7b5407640287e4e7069a53cf7100", + "rev": "81b8a3faf63f5b53e9d6e95aa09149941c4a2f11", "type": "github" }, "original": {
M
static/style.css
→
static/style.css
@@ -180,6 +180,7 @@ padding: 2px 0 20px 0;
margin-top: 3px !important; margin-bottom: 5px; color: var(--gray); + font-style: italic; } .muted {@@ -346,6 +347,13 @@ }
.footnotes ol li:not(:last-child) { padding-bottom: 2rem; +} + +.draft { + color: red; + font-weight: bold; + font-family: sans; + font-size: 1rem; } @media (max-width: 400px) {
M
templates/blog.html
→
templates/blog.html
@@ -21,7 +21,11 @@ {{ $posts := .Extra }}
{{ range $posts }} <tr> <td align="left"> + {{ if .Meta.draft }} + <p><a href=/blog/{{ .Meta.slug }}>{{ .Meta.title }}</a> <span class="draft">[draft]</span></p> + {{ else }} <p><a href=/blog/{{ .Meta.slug }}>{{ .Meta.title }}</a></p> + {{ end }} <p id="subtitle">{{ .Meta.subtitle }}</p> </td> {{ $dateStr := .Meta.date }}
M
templates/text.html
→
templates/text.html
@@ -19,7 +19,11 @@ {{ $date := parsedate $dateStr }}
{{ $date.Format "02 Jan, 2006" }} </section> + {{ if .Meta.draft }} + <h1>{{ index .Meta "title" }} <span class="draft">[draft]</span></h1> + {{ else }} <h1>{{ index .Meta "title" }}</h1> + {{ end }} <h2 class="subtitle">{{ index .Meta "subtitle" }}</h2> {{ .Body }}