1
0
Fork 0
mirror of https://git.sr.ht/~seirdy/seirdy.one synced 2024-11-23 21:02:09 +00:00

Add date last updated (gitinfo)

Add the date last updated to articles, if articles have been updated
since initial publication. Incldue a link to the article changelog.
This commit is contained in:
Rohan Kumar 2020-12-21 16:38:26 -08:00
parent 6331840d95
commit 758460f258
No known key found for this signature in database
GPG key ID: 1E892DB2A5F84479
5 changed files with 23 additions and 16 deletions

View file

@ -4,6 +4,7 @@ packages:
- rsync
- hugo
- zopfli
- git # for Hugo's gitInfo
- make
sources:
- https://git.sr.ht/~seirdy/seirdy.one

View file

@ -11,6 +11,9 @@ OUTPUT_DIR = public
RSYNCFLAGS += -rlvz --zc=zstd
hugo:
hugo --gc --enableGitInfo
# .hintrc-local for linting local files
# same as regular .hintrc but with a different connector.
.hintrc-local: .hintrc
@ -27,13 +30,10 @@ lint: lint-css hugo .hintrc-local
hint --config .hintrc-local -f codeframe $(OUTPUT_DIR)
check-links: hugo
lychee --verbose $(find public -type f -name '*.html' -o -name '*.gmi' -o -name '*.txt')
lychee --verbose $(find public -type f -name '*.html' -o -name '*.gmi' -o -name '*.txt') content/posts/*.md content/posts/*.gmi
test: lint check-links
hugo:
hugo --gc
build: hugo
# gzip_static + max zopfli compression
ifndef NO_GZIP_STATIC

View file

@ -12,6 +12,7 @@ pygmentsUseClasses = true
[params]
description = "Seirdy's Home: personal website and blog for Rohan Kumar, A.K.A. Seirdy"
src = "https://sr.ht/~seirdy/seirdy.one"
logUrlPrefix = "https://git.sr.ht/~seirdy/seirdy.one/log/master/item/"
copyright = "Copyright © 2020 Rohan Kumar"
dark = "auto"
highlight = false

View file

@ -1,10 +1,15 @@
# {{$.Title | safeHTML}}
{{ .Date.Format "2006-01-02" }}
{{ $lastmod := .Lastmod -}}
{{ if lt .Date $lastmod -}}
Originally posted {{ .Date.Format "2006-01-02" }}. Last updated {{ .Lastmod.Format "2006-01-02" }}.
{{ else -}}
Posted {{ .Date.Format "2006-01-02" }}.
{{ end }}
{{ trim (readFile (replace $.File.Path ".md" ".gmi")) "\n" | safeHTML }}
---
=> {{ .Site.Params.logUrlPrefix }}content/{{ .File.Path }} Article changelog
=> / Homepage{{ with .OutputFormats.Get "html" }}
=> {{.Permalink}} View “{{$.Title | safeHTML}}” on the WWW
{{- end }}

View file

@ -2,24 +2,24 @@
<article>
<header id="post-header">
<h1>{{ .Title }}</h1>
{{- if isset .Params "date" -}}
<time datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Date.Format "2006-01-02" }}</time>
{{- end -}}
{{ $lastmod := .Lastmod -}}
{{ if lt .Date $lastmod -}}
Originally posted <time datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Date.Format "2006-01-02" }}</time>. Last updated <time datetime="{{ $lastmod.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Lastmod.Format "2006-01-02" }}</time>. <a href="{{ .Site.Params.logUrlPrefix }}content/{{ .File.Path }}">Changelog</a>
{{ else -}}
Posted <time datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Date.Format "2006-01-02" }}</time>.
{{ end }}
</header>
{{- .Content -}}
{{ .Content -}}
</article>
<br>
<hr>
<footer class="comment">
{{ with .OutputFormats.Get "gemtext" }}
{{ with .OutputFormats.Get "gemtext" -}}
<p>
View this article on <a href="{{replace .Permalink "/gemini" "" 1 | safeURL}}">my Gemini capsule</a>
</p>
{{ end }}
<p>
<a href="mailto:~seirdy/seirdy.one-comments@lists.sr.ht">Send an email</a> to leave a comment in the <a href="https://lists.sr.ht/~seirdy/seirdy.one-comments">mailing list</a> for seirdy.one. You'll have to send in plain text; please <a href="https://useplaintext.email/">learn how.</a>. Alternatively, send your email <a href="mailto:seirdy@seirdy.one">directly to me</a>; it wont show up on the mailing list, but Ill see it.
</p>
{{ end -}}
<p><a href="mailto:~seirdy/seirdy.one-comments@lists.sr.ht">Send an email</a> to leave a comment in the <a href="https://lists.sr.ht/~seirdy/seirdy.one-comments">mailing list</a> for seirdy.one. You'll have to send in plain text; please <a href="https://useplaintext.email/">learn how.</a>. Alternatively, send your email <a href="mailto:seirdy@seirdy.one">directly to me</a>; it wont show up on the mailing list, but Ill see it.</p>
</footer>
<hr>
{{ end }}