From 4fe544d8c213bfd9b93a1d4a62f5a55c6e3e68bb Mon Sep 17 00:00:00 2001 From: George Cushen Date: Mon, 4 Nov 2024 15:43:58 +0000 Subject: [PATCH] feat: support latest Hugo to fix Markdown links no longer rendering --- modules/blox-tailwind/hugo.yaml | 1 - .../layouts/_default/home.backlinks.json | 10 ++++-- .../partials/components/backlinks.html | 31 ++++++++++--------- 3 files changed, 25 insertions(+), 17 deletions(-) diff --git a/modules/blox-tailwind/hugo.yaml b/modules/blox-tailwind/hugo.yaml index 90c98bb98..7b42fb106 100644 --- a/modules/blox-tailwind/hugo.yaml +++ b/modules/blox-tailwind/hugo.yaml @@ -90,7 +90,6 @@ outputFormats: baseName: backlinks isPlainText: true notAlternative: true - weight: 1 params: locale: date_format: 'Jan 2, 2006' diff --git a/modules/blox-tailwind/layouts/_default/home.backlinks.json b/modules/blox-tailwind/layouts/_default/home.backlinks.json index e249a1543..3d6d02c54 100644 --- a/modules/blox-tailwind/layouts/_default/home.backlinks.json +++ b/modules/blox-tailwind/layouts/_default/home.backlinks.json @@ -1,2 +1,8 @@ -{{- /* Hugo 0.126 requires a `home` layout even if it serves no purpose, otherwise shows warning */ -}} -{{- jsonify dict -}} +{{- /* Hugo 0.126+ requires a `home` layout file even if it's empty, otherwise shows warning */ -}} +{{- if (eq (getenv "HUGO_BLOX_DEBUG") "true") -}} + {{- range site.Pages -}}{{- $_ := .WordCount -}}{{- end -}} + {{- $backlinks := (.Store.Get "backlinks" | uniq) | default dict -}} + {{- jsonify (dict "indent" " ") $backlinks -}} +{{- else -}} + {{- jsonify dict -}} +{{- end -}} diff --git a/modules/blox-tailwind/layouts/partials/components/backlinks.html b/modules/blox-tailwind/layouts/partials/components/backlinks.html index 3ff15dc26..ec0e7798b 100644 --- a/modules/blox-tailwind/layouts/partials/components/backlinks.html +++ b/modules/blox-tailwind/layouts/partials/components/backlinks.html @@ -1,19 +1,22 @@ {{ $show_backlinks := .Params.backlinks | default true }} {{ if $show_backlinks }} - {{ $backlinks := site.Home.Store.Get "backlinks" | uniq }} - {{ with (where $backlinks "links_to" .RelPermalink) }} -