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 - rsync
- hugo - hugo
- zopfli - zopfli
- git # for Hugo's gitInfo
- make - make
sources: sources:
- https://git.sr.ht/~seirdy/seirdy.one - https://git.sr.ht/~seirdy/seirdy.one

View file

@ -11,6 +11,9 @@ OUTPUT_DIR = public
RSYNCFLAGS += -rlvz --zc=zstd RSYNCFLAGS += -rlvz --zc=zstd
hugo:
hugo --gc --enableGitInfo
# .hintrc-local for linting local files # .hintrc-local for linting local files
# same as regular .hintrc but with a different connector. # same as regular .hintrc but with a different connector.
.hintrc-local: .hintrc .hintrc-local: .hintrc
@ -27,13 +30,10 @@ lint: lint-css hugo .hintrc-local
hint --config .hintrc-local -f codeframe $(OUTPUT_DIR) hint --config .hintrc-local -f codeframe $(OUTPUT_DIR)
check-links: hugo 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 test: lint check-links
hugo:
hugo --gc
build: hugo build: hugo
# gzip_static + max zopfli compression # gzip_static + max zopfli compression
ifndef NO_GZIP_STATIC ifndef NO_GZIP_STATIC

View file

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

View file

@ -1,10 +1,15 @@
# {{$.Title | safeHTML}} # {{$.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 }} {{ trim (readFile (replace $.File.Path ".md" ".gmi")) "\n" | safeHTML }}
--- ---
=> {{ .Site.Params.logUrlPrefix }}content/{{ .File.Path }} Article changelog
=> / Homepage{{ with .OutputFormats.Get "html" }} => / Homepage{{ with .OutputFormats.Get "html" }}
=> {{.Permalink}} View “{{$.Title | safeHTML}}” on the WWW => {{.Permalink}} View “{{$.Title | safeHTML}}” on the WWW
{{- end }} {{- end }}

View file

@ -2,24 +2,24 @@
<article> <article>
<header id="post-header"> <header id="post-header">
<h1>{{ .Title }}</h1> <h1>{{ .Title }}</h1>
{{- if isset .Params "date" -}} {{ $lastmod := .Lastmod -}}
<time datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Date.Format "2006-01-02" }}</time> {{ if lt .Date $lastmod -}}
{{- end -}} 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> </header>
{{- .Content -}} {{ .Content -}}
</article> </article>
<br> <br>
<hr> <hr>
<footer class="comment"> <footer class="comment">
{{ with .OutputFormats.Get "gemtext" }} {{ with .OutputFormats.Get "gemtext" -}}
<p> <p>
View this article on <a href="{{replace .Permalink "/gemini" "" 1 | safeURL}}">my Gemini capsule</a> View this article on <a href="{{replace .Permalink "/gemini" "" 1 | safeURL}}">my Gemini capsule</a>
</p> </p>
{{ end }} {{ end -}}
<p> <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>
<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> </footer>
<hr> <hr>
{{ end }} {{ end }}