From 8be58016ae2b6ab13a4645a49a0539517f385fcc Mon Sep 17 00:00:00 2001 From: ZhenShuo Leo <98386542+ZhenShuo2021@users.noreply.github.com> Date: Thu, 15 May 2025 14:52:06 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20allow=20self-linking=20in?= =?UTF-8?q?=20article=20shortcode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- layouts/shortcodes/article.html | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/layouts/shortcodes/article.html b/layouts/shortcodes/article.html index 393529a4..b85a3ca2 100644 --- a/layouts/shortcodes/article.html +++ b/layouts/shortcodes/article.html @@ -1,10 +1,10 @@ {{ $link := .Get "link" }} -{{ $parent := .Page.RelPermalink }} -{{ with first 1 (where .Site.AllPages "RelPermalink" $link) }} - {{ $target := index . 0 }} - {{ if ne $target.RelPermalink $parent }} -
- {{ partial "article-link/simple.html" $target }} -
- {{ end }} -{{ end }} \ No newline at end of file +{{ $target := .Page }} +{{ if ne $link .Page.RelPermalink }} + {{ $target = index (first 1 (where .Site.AllPages "RelPermalink" $link)) 0 }} +{{ end }} +{{ if $target }} +
+ {{ partial "article-link/simple.html" $target }} +
+{{ end }}