mirror of
https://github.com/by-jp/www.byjp.me.git
synced 2025-08-09 05:36:07 +01:00
Add last-built timestamp & helpers
This commit is contained in:
parent
58e22e47ad
commit
122c3fc1c5
7 changed files with 22 additions and 2 deletions
2
.env
Normal file
2
.env
Normal file
|
@ -0,0 +1,2 @@
|
|||
HUGO_LAST_UPDATE_TIME=$(git log -1 --format=%cI)
|
||||
HUGO_LAST_UPDATE_HASH=$(git log -1 --format=%h)
|
5
.github/workflows/publish.yml
vendored
5
.github/workflows/publish.yml
vendored
|
@ -3,6 +3,10 @@ name: Deploy Hugo site to Pages
|
|||
on:
|
||||
push:
|
||||
branches: ["main"]
|
||||
schedule:
|
||||
# Rebuild at the first moment of the new year
|
||||
# ensures that anywhere I'm using year-relative dates stay accurate.
|
||||
- cron: '0 0 1 1 *'
|
||||
|
||||
workflow_dispatch:
|
||||
|
||||
|
@ -49,6 +53,7 @@ jobs:
|
|||
HUGO_ENVIRONMENT: production
|
||||
HUGO_ENV: production
|
||||
run: |
|
||||
set -o allexport; source .env; set +o allexport
|
||||
hugo \
|
||||
--cacheDir /tmp/hugo/cache \
|
||||
--minify \
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
# byJP.me
|
||||
|
||||
This is the source code for my blog at https://byjp.me. It's built with [hugo](https://gohugo.io/), is built with Github Actions, and is deployed to Github's static content servers.
|
||||
This is the source code for my blog at [www.byjp.me](https://wwwbyjp.me). It's built with [hugo](https://gohugo.io/), using [Github Actions](https://github.com/by-jp/www.byjp.me/blob/main/.github/workflows/publish.yml), and is deployed to both Github's static content servers and the [InterPlanetary FileSystem](https://www-byjp-me.ipns.dweb.link/).
|
||||
|
|
7
layouts/partials/site-last-update.html
Normal file
7
layouts/partials/site-last-update.html
Normal file
|
@ -0,0 +1,7 @@
|
|||
{{ if or (getenv "HUGO_LAST_UPDATE_TIME") (getenv "HUGO_LAST_UPDATE_HASH") }}
|
||||
<small style="font-style:italic">
|
||||
Last updated
|
||||
{{ with getenv "HUGO_LAST_UPDATE_TIME" }}on {{ partial "year-relative-date.html" . }},{{ end }}
|
||||
{{ with getenv "HUGO_LAST_UPDATE_HASH" }}from <a href="https://github.com/by-jp/www.byjp.me/tree/{{ . }}">{{ . }}</a>{{ end }}.
|
||||
</small>
|
||||
{{ end }}
|
1
layouts/partials/year-relative-date.html
Normal file
1
layouts/partials/year-relative-date.html
Normal file
|
@ -0,0 +1 @@
|
|||
<time timestamp="{{ . }}" title="{{ time . | dateFormat "2006-01-02 03:04 MST" }}">{{ time . | dateFormat "January 2" }}{{ if ne (time . | dateFormat "2006") (now | dateFormat "2006") }} {{ now | dateFormat "2006" }}{{ end }}</time>
|
|
@ -725,4 +725,8 @@ select:focus + .focus {
|
|||
margin-right: 3px;
|
||||
text-decoration: none;
|
||||
display:inline-block;
|
||||
}
|
||||
|
||||
time:hover, abbr:hover {
|
||||
border-bottom: 1px dotted;
|
||||
}
|
|
@ -23,7 +23,8 @@
|
|||
<hr />
|
||||
<section class="posts" style="text-align:center">
|
||||
{{ partial "about-me.html" .}}
|
||||
</section>
|
||||
|
||||
{{ partial "site-last-update.html" }}
|
||||
</section>
|
||||
</main>
|
||||
{{ end }}
|
||||
|
|
Loading…
Reference in a new issue