Skip to content

Commit

Permalink
feat: support latest Hugo to fix Markdown links no longer rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
gcushen committed Nov 4, 2024
1 parent adc14f1 commit 4fe544d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 17 deletions.
1 change: 0 additions & 1 deletion modules/blox-tailwind/hugo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ outputFormats:
baseName: backlinks
isPlainText: true
notAlternative: true
weight: 1
params:
locale:
date_format: 'Jan 2, 2006'
Expand Down
10 changes: 8 additions & 2 deletions modules/blox-tailwind/layouts/_default/home.backlinks.json
Original file line number Diff line number Diff line change
@@ -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 -}}
31 changes: 17 additions & 14 deletions modules/blox-tailwind/layouts/partials/components/backlinks.html
Original file line number Diff line number Diff line change
@@ -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) }}
<div class="backlinks">
<div class="mb-1 font-semibold tracking-tight">
{{ (T "backlinks") | default "Backlinks" }}
{{ $defer_globals := (dict "page" . )}}
{{ with (templates.Defer (dict "data" $defer_globals )) }}
{{ $backlinks := (site.Home.Store.Get "backlinks" | uniq) | default dict }}
{{ with (where $backlinks "links_to" .page.RelPermalink) }}
<div class="backlinks">
<div class="mb-1 font-semibold tracking-tight">
{{ (T "backlinks") | default "Backlinks" }}
</div>
<ul>
{{ range (sort . "page.date" "desc") }}
{{ $page := .page }}
<li>
<a href="{{ $page.relPermalink }}" class="backlink">{{ $page.linkTitle }}</a>
</li>
{{ end }}
</ul>
</div>
<ul>
{{ range (sort . "page.date" "desc") }}
{{ $page := .page }}
<li>
<a href="{{ $page.relPermalink }}" class="backlink">{{ $page.linkTitle }}</a>
</li>
{{ end }}
</ul>
</div>
{{ end }}
{{ end }}
{{ end }}

0 comments on commit 4fe544d

Please # to comment.