Skip to content

Commit 45ffd2f

Browse files
committed
fix: 兼容最新的 Hugo 版本;修复 README 中模板语法转义报错
1 parent 5b84fcb commit 45ffd2f

3 files changed

Lines changed: 4 additions & 3 deletions

File tree

hugo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616
[module]
1717
[module.hugoVersion]
1818
extended = true
19-
min = "0.146.0"
19+
min = "0.156.0"

layouts/_partials/adapters/projects.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
{{- if $projectsAdapters.enable -}}
2424
{{- warnf "component-projects\n%v" (T "projects.warningAdapter") -}}
25-
{{- $data := index .Site.Data (printf "projects.%v" .Site.Language.Lang) | default .Site.Data.projects -}}
25+
{{- $data := index hugo.Data (printf "projects.%v" .Site.Language.Lang) | default hugo.Data.projects -}}
2626
{{- $renderedRepos := slice -}}
2727
{{- $auth := dict "Authorization" "" -}}
2828
{{- with (getenv "HUGO_PARAMS_GHTOKEN") -}}
@@ -105,6 +105,7 @@
105105
{{- $markdown := $readme.content | base64Decode -}}
106106
{{- /* Convert Hugo shortcodes to markdown plain text */ -}}
107107
{{- $markdown = replace $markdown "{{<" "{{?{}<" -}}
108+
{{- $markdown = replace $markdown "{{%" "{{?{}%" -}}
108109
{{- /* Convert relative links to absolute links in the README content */ -}}
109110
{{- $replacement := printf "$1[$2](%v$3$4)" (printf "https://raw.githubusercontent.com/%v/refs/heads/%v" $repoInfo.full_name $repoInfo.default_branch) -}}
110111
{{- /* Oops! Lookahead regular lookup is not supported in Golang, e.g `(?!http)` */ -}}

layouts/projects.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
{{- if $hiddenAdapters -}}
1212
{{- $pages = where $pages "File.IsContentAdapter" "ne" true -}}
1313
{{- end -}}
14-
{{- $data := index .Site.Data (printf "projects.%v" .Language) | default .Site.Data.projects -}}
14+
{{- $data := index hugo.Data (printf "projects.%v" .Language) | default hugo.Data.projects -}}
1515
{{- $toc := .Store.Get "toc" -}}
1616
{{- $tableOfContents := .Fragments.ToHTML ($toc.startlevel | int) ($toc.endlevel | int) false -}}
1717
{{- $contentToc := ne $tableOfContents `<nav id="TableOfContents"></nav>` -}}

0 commit comments

Comments
 (0)