my website at https://anirudh.fi
4
fork

Configure Feed

Select the types of activity you want to include in your feed.

templates: add support for drafts

+26 -8
+2
.gitignore
··· 2 2 build/ 3 3 bin/replace 4 4 .direnv 5 + .aider* 6 + .env
+1 -1
bin/build.sh
··· 4 4 git clone https://github.com/icyphox/go-vite 5 5 cd go-vite && make && cd .. 6 6 mkdir build 7 - go-vite/vite build 7 + go-vite/vite build --drafts
+1 -1
bin/serve.sh
··· 16 16 trap "kill_vite" INT 17 17 18 18 "$vite" serve & 19 - find pages/ static/ templates/ | entr "$vite" build 19 + find pages/ static/ templates/ | entr "$vite" build --drafts 20 20 21 21 trap SIGINT
+6 -6
flake.lock
··· 2 2 "nodes": { 3 3 "nixpkgs": { 4 4 "locked": { 5 - "lastModified": 1721833789, 6 - "narHash": "sha256-VQw64O2UO0SnJlYiE9jvF9QVcFZgxvfiQxV2sKA20MU=", 5 + "lastModified": 1731852624, 6 + "narHash": "sha256-hfR6InYghPqZo5Lvojj6LqpJumh7G62oD0RN8VfBnkU=", 7 7 "owner": "nixos", 8 8 "repo": "nixpkgs", 9 - "rev": "0e34403dab7f1171e0a2e4f5a47c32e7db95d0b2", 9 + "rev": "8447f0f3e60462c5889a709af429b12b47c29ac5", 10 10 "type": "github" 11 11 }, 12 12 "original": { ··· 41 41 "nixpkgs": "nixpkgs_2" 42 42 }, 43 43 "locked": { 44 - "lastModified": 1721802063, 45 - "narHash": "sha256-rmfHh+td7P7vyg4t1XsGroNxeNDIlAGtFwMdWbvG/9A=", 44 + "lastModified": 1731853533, 45 + "narHash": "sha256-0KTyWOBy6Eub2hT3EN2Qri6l09vlxeg69XZlexwzl2s=", 46 46 "owner": "icyphox", 47 47 "repo": "go-vite", 48 - "rev": "45310dfe7ecd7b5407640287e4e7069a53cf7100", 48 + "rev": "81b8a3faf63f5b53e9d6e95aa09149941c4a2f11", 49 49 "type": "github" 50 50 }, 51 51 "original": {
+8
static/style.css
··· 180 180 margin-top: 3px !important; 181 181 margin-bottom: 5px; 182 182 color: var(--gray); 183 + font-style: italic; 183 184 } 184 185 185 186 .muted { ··· 346 347 347 348 .footnotes ol li:not(:last-child) { 348 349 padding-bottom: 2rem; 350 + } 351 + 352 + .draft { 353 + color: red; 354 + font-weight: bold; 355 + font-family: sans; 356 + font-size: 1rem; 349 357 } 350 358 351 359 @media (max-width: 400px) {
+4
templates/blog.html
··· 21 21 {{ range $posts }} 22 22 <tr> 23 23 <td align="left"> 24 + {{ if .Meta.draft }} 25 + <p><a href=/blog/{{ .Meta.slug }}>{{ .Meta.title }}</a> <span class="draft">[draft]</span></p> 26 + {{ else }} 24 27 <p><a href=/blog/{{ .Meta.slug }}>{{ .Meta.title }}</a></p> 28 + {{ end }} 25 29 <p id="subtitle">{{ .Meta.subtitle }}</p> 26 30 </td> 27 31 {{ $dateStr := .Meta.date }}
+4
templates/text.html
··· 19 19 {{ $date.Format "02 Jan, 2006" }} 20 20 </section> 21 21 22 + {{ if .Meta.draft }} 23 + <h1>{{ index .Meta "title" }} <span class="draft">[draft]</span></h1> 24 + {{ else }} 22 25 <h1>{{ index .Meta "title" }}</h1> 26 + {{ end }} 23 27 <h2 class="subtitle">{{ index .Meta "subtitle" }}</h2> 24 28 {{ .Body }} 25 29