Skip to content

Commit

Permalink
Fix: 修复没有文章时还会出现相关问题的目录
Browse files Browse the repository at this point in the history
  • Loading branch information
Lruihao committed Oct 22, 2024
1 parent b048d38 commit 7ee7c26
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ A Hugo theme component with layout `projects` and shortcodes to display GitHub p

## Demo

- <https://fixit.lruihao.cn/components/>
- <https://fixit.lruihao.cn/ecosystem/>
- <https://lruihao.cn/projects/>

## Requirements
Expand Down
2 changes: 1 addition & 1 deletion README.zh-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

## Demo

- <https://fixit.lruihao.cn/zh-cn/components/>
- <https://fixit.lruihao.cn/zh-cn/ecosystem/>
- <https://lruihao.cn/projects/>

## 要求
Expand Down
2 changes: 1 addition & 1 deletion i18n/en.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}<br>Website: <{{ . }}>{{ end }}"
poweredBy = "This page is powered by <a href=\"https://github.com/hugo-fixit/component-projects\">Component Projects</a>."
Expand Down
2 changes: 1 addition & 1 deletion i18n/zh-CN.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[projects]
relatedArticles = "相关文章"
errorGetGhRepo = "从 GitHub API 获取仓库信息失败,请检查网络!"
warningLayout = "{{ .Permalink }} 页面正在通过网络获取仓库,请稍等片刻……"
warningLayout = "{{ .RelPermalink }} 页面正在通过网络获取仓库,请稍等片刻……"
warningAdapter = "内容适配器正在通过网络获取 GitHub README,请稍等片刻……"
source = "来源:[{{ .Name }}]({{ .Link }}){{ with .Website }}<br>网站:<{{ . }}>{{ end }}"
poweredBy = "本页面由 <a href=\"https://github.com/hugo-fixit/component-projects\">Component Projects</a> 强力驱动。"
Expand Down
6 changes: 4 additions & 2 deletions layouts/section/projects.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ <h1 class="single-title animate__animated animate__pulse animate__faster">
{{- $tocFromData = add $tocFromData (printf "<li><a href=\"#%v\">%v</a></li>" ($group.title | anchorize) $group.title) -}}
{{- end -}}
{{- end -}}
{{- $tocFromData = add $tocFromData (printf "<li><a href=\"#related-articles\">%v</a></li>" (T "projects.relatedArticles")) -}}
{{- if .Pages -}}
{{- $tocFromData = add $tocFromData (printf "<li><a href=\"#related-articles\">%v</a></li>" (T "projects.relatedArticles")) -}}
{{- end -}}
{{- with $tocFromData -}}
{{- if $contentToc -}}
{{- $tableOfContents = replaceRE "</ul>[\\s]?</nav>" (printf "%v</ul></nav>" .) $tableOfContents -}}
Expand All @@ -95,7 +97,7 @@ <h1 class="single-title animate__animated animate__pulse animate__faster">
{{- /* Content */ -}}
<div class="content" id="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 -}}
Expand Down

0 comments on commit 7ee7c26

Please sign in to comment.