From cfba9572c289d6c612c696d1e441ec93a94f9499 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Winterhalter?= Date: Thu, 7 Nov 2024 15:52:31 +0100 Subject: [PATCH] Add last updated date --- .github/workflows/webpage.yaml | 1 + Makefile | 1 + README.md | 14 ++++++++++++++ pandoc/date.lua | 6 ++++++ pandoc/template.html4 | 2 ++ src/index.md | 5 ++++- website/style.css | 4 ++++ 7 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 pandoc/date.lua diff --git a/.github/workflows/webpage.yaml b/.github/workflows/webpage.yaml index a2869f5..660a42d 100644 --- a/.github/workflows/webpage.yaml +++ b/.github/workflows/webpage.yaml @@ -39,6 +39,7 @@ jobs: --toc-depth=1 --resource-path=. --lua-filter=pandoc/paper.lua + --lua-filter=pandoc/date.lua src/index.md - name: Setup Pages diff --git a/Makefile b/Makefile index 0bddd10..5765127 100644 --- a/Makefile +++ b/Makefile @@ -10,4 +10,5 @@ website: --toc-depth=1 \ --resource-path=. \ --lua-filter=pandoc/paper.lua \ + --lua-filter=pandoc/date.lua \ src/index.md diff --git a/README.md b/README.md index bc92b6e..367cc3d 100644 --- a/README.md +++ b/README.md @@ -197,6 +197,20 @@ assume them to be empty otherwise), while the other fields (`venue`, `year`, * `link` * `git` +## Updating the HTML template + +The `pandoc/template.html4` file contains an HTML template which you can edit +to suit your taste. Any variable mentioned in the header of your `index.md` can +be moved around, and you can even add your own. + +There is also a special filter called `pandoc/date.lua` which produces an extra +variable called `date` (unless it is already provided in the header) that is +currently used in the footer of the template to indicate the last time the page +was generated. + +> [!NOTE] +> It will only appear in the footer if the `footer` variable is set. + ## Sharing files Anything you put in the `website` directory will be available online too. diff --git a/pandoc/date.lua b/pandoc/date.lua new file mode 100644 index 0000000..14da312 --- /dev/null +++ b/pandoc/date.lua @@ -0,0 +1,6 @@ +function Meta(m) + if m.date == nil then + m.date = os.date("%e %B %Y") + return m + end +end diff --git a/pandoc/template.html4 b/pandoc/template.html4 index 8a9ca23..8e09160 100644 --- a/pandoc/template.html4 +++ b/pandoc/template.html4 @@ -159,6 +159,8 @@ $if(footer)$ $endif$ diff --git a/src/index.md b/src/index.md index c412c28..67a2a7d 100644 --- a/src/index.md +++ b/src/index.md @@ -21,7 +21,10 @@ gitlab: gitlab bitbucket: bitbucket.com bluesky: https://bsky.app/ linkedin: https://www.linkedin.com -footer: Based on the [basicpage template](https://github.com/basicpage/basicpage.github.io), made to be easy to use! 🎓 +footer: >- + Based on the + [basicpage template](https://github.com/basicpage/basicpage.github.io), + made to be easy to use! 🎓 --- I am a (fake) PhD student, working on 👽 science on all kinds of related topics. diff --git a/website/style.css b/website/style.css index 1a6d57d..31ecb43 100644 --- a/website/style.css +++ b/website/style.css @@ -335,6 +335,10 @@ div.files a:hover { text-decoration: none; } +span.lastupdate { + color: #9e9d9d; +} + @media screen and (min-width: 1000px) { header.split { flex-direction: row;