From 7ee7c26320939d97ad9006146f2a59ec1c7eade0 Mon Sep 17 00:00:00 2001
From: Cell <1024@lruihao.cn>
Date: Tue, 22 Oct 2024 11:35:47 +0800
Subject: [PATCH] =?UTF-8?q?Fix:=20=E4=BF=AE=E5=A4=8D=E6=B2=A1=E6=9C=89?=
=?UTF-8?q?=E6=96=87=E7=AB=A0=E6=97=B6=E8=BF=98=E4=BC=9A=E5=87=BA=E7=8E=B0?=
=?UTF-8?q?=E7=9B=B8=E5=85=B3=E9=97=AE=E9=A2=98=E7=9A=84=E7=9B=AE=E5=BD=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 2 +-
README.zh-cn.md | 2 +-
i18n/en.toml | 2 +-
i18n/zh-CN.toml | 2 +-
layouts/section/projects.html | 6 ++++--
5 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/README.md b/README.md
index d95fb70..e3374ba 100644
--- a/README.md
+++ b/README.md
@@ -8,7 +8,7 @@ A Hugo theme component with layout `projects` and shortcodes to display GitHub p
## Demo
--
+-
-
## Requirements
diff --git a/README.zh-cn.md b/README.zh-cn.md
index 81c8317..3e38946 100644
--- a/README.zh-cn.md
+++ b/README.zh-cn.md
@@ -8,7 +8,7 @@
## Demo
--
+-
-
## 要求
diff --git a/i18n/en.toml b/i18n/en.toml
index 344fad3..541e77a 100644
--- a/i18n/en.toml
+++ b/i18n/en.toml
@@ -4,7 +4,7 @@
[projects]
relatedArticles = "Related Articles"
errorGetGhRepo = "Failed to fetch repo info from GitHub API, Please check the network!"
-warningLayout = "The page {{ .Permalink }} is getting repositories via network, please wait a moment..."
+warningLayout = "The page {{ .RelPermalink }} is getting repositories via network, please wait a moment..."
warningAdapter = "The content adapter is getting GitHub README via network, please wait a moment..."
source = "Source: [{{ .Name }}]({{ .Link }}){{ with .Website }}
Website: <{{ . }}>{{ end }}"
poweredBy = "This page is powered by Component Projects."
diff --git a/i18n/zh-CN.toml b/i18n/zh-CN.toml
index a99a6ad..3c6fc22 100644
--- a/i18n/zh-CN.toml
+++ b/i18n/zh-CN.toml
@@ -5,7 +5,7 @@
[projects]
relatedArticles = "相关文章"
errorGetGhRepo = "从 GitHub API 获取仓库信息失败,请检查网络!"
-warningLayout = "{{ .Permalink }} 页面正在通过网络获取仓库,请稍等片刻……"
+warningLayout = "{{ .RelPermalink }} 页面正在通过网络获取仓库,请稍等片刻……"
warningAdapter = "内容适配器正在通过网络获取 GitHub README,请稍等片刻……"
source = "来源:[{{ .Name }}]({{ .Link }}){{ with .Website }}
网站:<{{ . }}>{{ end }}"
poweredBy = "本页面由 Component Projects 强力驱动。"
diff --git a/layouts/section/projects.html b/layouts/section/projects.html
index ad4274a..3ca81cb 100644
--- a/layouts/section/projects.html
+++ b/layouts/section/projects.html
@@ -73,7 +73,9 @@
{{- $tocFromData = add $tocFromData (printf "
%v" ($group.title | anchorize) $group.title) -}}
{{- end -}}
{{- end -}}
- {{- $tocFromData = add $tocFromData (printf "%v" (T "projects.relatedArticles")) -}}
+ {{- if .Pages -}}
+ {{- $tocFromData = add $tocFromData (printf "%v" (T "projects.relatedArticles")) -}}
+ {{- end -}}
{{- with $tocFromData -}}
{{- if $contentToc -}}
{{- $tableOfContents = replaceRE "[\\s]?" (printf "%v" .) $tableOfContents -}}
@@ -95,7 +97,7 @@
{{- /* Content */ -}}
{{- dict "Content" .Content "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}}
- {{- warnf "component-projects\n%v" (T "projects.warningLayout" (dict "Permalink" .Permalink)) -}}
+ {{- warnf "component-projects\n%v" (T "projects.warningLayout" (dict "RelPermalink" .RelPermalink)) -}}
{{- $headers := dict "headers" (.Scratch.Get "githubTokenHeader") -}}
{{- $githubLangColors := partial "function/get-remote-json" (dict "URL" "https://raw.githubusercontent.com/ozh/github-colors/master/colors.json" "OPTIONS" $headers ) -}}
{{- range $group := $data -}}