feat: allow self-linking in article shortcode

This commit is contained in:
ZhenShuo Leo
2025-05-15 14:52:06 +08:00
parent 61fcafc319
commit 8be58016ae
+8 -8
View File
@@ -1,10 +1,10 @@
{{ $link := .Get "link" }} {{ $link := .Get "link" }}
{{ $parent := .Page.RelPermalink }} {{ $target := .Page }}
{{ with first 1 (where .Site.AllPages "RelPermalink" $link) }} {{ if ne $link .Page.RelPermalink }}
{{ $target := index . 0 }} {{ $target = index (first 1 (where .Site.AllPages "RelPermalink" $link)) 0 }}
{{ if ne $target.RelPermalink $parent }} {{ end }}
<section class="space-y-10 w-full"> {{ if $target }}
{{ partial "article-link/simple.html" $target }} <section class="space-y-10 w-full">
</section> {{ partial "article-link/simple.html" $target }}
{{ end }} </section>
{{ end }} {{ end }}