-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support latest Hugo to fix Markdown links no longer rendering
- Loading branch information
Showing
3 changed files
with
25 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
31
modules/blox-tailwind/layouts/partials/components/backlinks.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |