From b62a6e7e58b9cf021b3d8146a93f6ef0469cbe7b Mon Sep 17 00:00:00 2001 From: Ivaylo Ivanov Date: Sun, 1 Dec 2024 18:54:32 +0100 Subject: [PATCH] Expand social and add archive shortcode --- layouts/partials/social.html | 39 +++++++++++++++++++++++++++++++++ layouts/shortcodes/archive.html | 20 +++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 layouts/shortcodes/archive.html diff --git a/layouts/partials/social.html b/layouts/partials/social.html index a632505..43bfbb1 100644 --- a/layouts/partials/social.html +++ b/layouts/partials/social.html @@ -236,6 +236,45 @@ {{ end }} + {{ if isset .Site.Params "email" }} + + + + + + {{ end }} + + {{ if isset .Site.Params "gitea" }} + + + + + + {{ end }} + + + + + + + + + + + + + + + + + + + diff --git a/layouts/shortcodes/archive.html b/layouts/shortcodes/archive.html new file mode 100644 index 0000000..32badb4 --- /dev/null +++ b/layouts/shortcodes/archive.html @@ -0,0 +1,20 @@ +{{/* + +simple shortcode to display all posts in yearly sections on your archive page +by Charl P. Botha + +this is a much simplified version of the yearly post archiving template at: +https://rohanverma.net/blog/2019/11/15/archive-pages-group-by-year-hugo/ + +*/}} + +{{ $prev := 3000}} +{{range where .Site.RegularPages "Section" "posts"}} +{{if .Date}} +{{if gt $prev (.Date.Format "2006")}} +## {{ .Date.Format "2006" }} +{{end}} +{{.Date.Format "02 Jan"}} -- [{{.Title}}]({{.Permalink}}) +{{ $prev = .Date.Format "2006"}} +{{end}} +{{end}}