From 61fcafc3198dd2f10729e80511efa818cfb5ae1a Mon Sep 17 00:00:00 2001 From: ZhenShuo Leo <98386542+ZhenShuo2021@users.noreply.github.com> Date: Sun, 11 May 2025 21:18:05 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=90=9B=20fix:=20article=20shortcode?= =?UTF-8?q?=20across=20languages=20(#2130)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- layouts/shortcodes/article.html | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/layouts/shortcodes/article.html b/layouts/shortcodes/article.html index 68d74e71..393529a4 100644 --- a/layouts/shortcodes/article.html +++ b/layouts/shortcodes/article.html @@ -1,9 +1,10 @@ +{{ $link := .Get "link" }} {{ $parent := .Page.RelPermalink }} -
- {{ $RelPermalink := .Get "link" }} - {{ range ( where .Site.RegularPages "RelPermalink" $RelPermalink | first 1 ) }} - {{ if not (eq .RelPermalink $parent) }} - {{ partial "article-link/simple.html" . }} - {{ end }} - {{end}} -
\ No newline at end of file +{{ 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 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 2/2] =?UTF-8?q?=E2=9C=A8=20feat:=20allow=20self-linking=20?= =?UTF-8?q?in=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 }}