Add backlinks to journal + notes
This commit is contained in:
@@ -18,4 +18,5 @@
|
|||||||
{{ .Content }}
|
{{ .Content }}
|
||||||
|
|
||||||
{{- partial "references.html" . -}}
|
{{- partial "references.html" . -}}
|
||||||
|
{{- partial "backlinks.html" . -}}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|||||||
@@ -6,4 +6,5 @@
|
|||||||
{{ .Content }}
|
{{ .Content }}
|
||||||
|
|
||||||
{{- partial "references.html" . -}}
|
{{- partial "references.html" . -}}
|
||||||
|
{{- partial "backlinks.html" . -}}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|||||||
27
themes/v2/layouts/partials/backlinks.html
Normal file
27
themes/v2/layouts/partials/backlinks.html
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
{{ $currlink := .RelPermalink }}
|
||||||
|
{{ $noslash := substr .RelPermalink 0 -1 }}
|
||||||
|
{{ $backlinks := slice }}
|
||||||
|
|
||||||
|
{{ range .Site.Pages }}
|
||||||
|
{{ $found := findRE $noslash .Content 1 }}
|
||||||
|
|
||||||
|
{{ if and ($found) (ne $currlink .RelPermalink) }}
|
||||||
|
{{ $backlinks = $backlinks | append . }}
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ with $backlinks }}
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<div class="references">
|
||||||
|
<h3>Backlinks</h3>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
{{ range . }}
|
||||||
|
<li>
|
||||||
|
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
|
||||||
|
</li>
|
||||||
|
{{ end }}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
||||||
Reference in New Issue
Block a user