From b594a39d67104513b6037a84c4d3229de65df071 Mon Sep 17 00:00:00 2001 From: Cell <1024@lruihao.cn> Date: Wed, 2 Oct 2024 02:27:47 +0800 Subject: [PATCH] =?UTF-8?q?Feat:=20=E4=BD=BF=E7=94=A8=E4=BB=93=E5=BA=93?= =?UTF-8?q?=E6=8B=A5=E6=9C=89=E8=80=85=E5=BD=93=E4=BD=9C=E6=96=87=E7=AB=A0?= =?UTF-8?q?=E4=BD=9C=E8=80=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/_default/hugo.toml | 3 ++- config/_default/params.toml | 2 +- content/en/components/_content.gotmpl | 14 ++++++++++---- content/zh-cn/components/_content.gotmpl | 14 ++++++++++---- go.mod | 4 ++-- go.sum | 8 ++++---- 6 files changed, 29 insertions(+), 16 deletions(-) diff --git a/config/_default/hugo.toml b/config/_default/hugo.toml index 792d20d..4aced54 100644 --- a/config/_default/hugo.toml +++ b/config/_default/hugo.toml @@ -30,7 +30,8 @@ hasCJKLanguage = false # default amount of posts in each pages # 默认每页列表显示的文章数目 -paginate = 12 +# TODO deprecated: site config key paginate was deprecated in Hugo v0.128.0 and will be removed in a future release. Use pagination.pagerSize instead. +# paginate = 12 # copyright description used only for seo schema # 版权描述,仅仅用于 SEO copyright = "" diff --git a/config/_default/params.toml b/config/_default/params.toml index 4fa5aed..94bcda0 100644 --- a/config/_default/params.toml +++ b/config/_default/params.toml @@ -617,7 +617,7 @@ disableThemeInject = false enable = true # Gravatar host, default: "www.gravatar.com" # Gravatar 主机,默认:“www.gravatar.com” - host = "gravatar.lruihao.cn" # ["cravatar.cn", "gravatar.loli.net", ...] + host = "gravatar.loli.net" # ["cravatar.cn", "gravatar.loli.net", ...] style = "mp" # ["", "mp", "identicon", "monsterid", "wavatar", "retro", "blank", "robohash"] # Back to top diff --git a/content/en/components/_content.gotmpl b/content/en/components/_content.gotmpl index bb2e256..2e178bf 100644 --- a/content/en/components/_content.gotmpl +++ b/content/en/components/_content.gotmpl @@ -26,14 +26,14 @@ {{- end -}} {{- $projectsAdapters.ignoreList -}} {{- $repoAPI := printf "https://api.github.com/repos/%v" $repo -}} - {{- $repoInfo := partial "function/get-remote-json" (dict "URL" $repoAPI "OPTIONS" $headers ) -}} + {{- $repoInfo := partial "function/get-remote-json" (dict "URL" $repoAPI "OPTIONS" $headers) -}} {{- $readmeAPI := printf "https://api.github.com/repos/%v/contents/README.%v.md" $repo $.Site.Language.Lang -}} - {{- $readme := partial "function/get-remote-json" (dict "URL" $readmeAPI "OPTIONS" $headers ) -}} + {{- $readme := partial "function/get-remote-json" (dict "URL" $readmeAPI "OPTIONS" $headers) -}} {{- /* Get the default README if the multi-language README is not available */ -}} {{- if not $readme -}} {{- $readmeAPI = printf "https://api.github.com/repos/%v/readme" $repo -}} - {{- $readme = partial "function/get-remote-json" (dict "URL" $readmeAPI "OPTIONS" $headers ) -}} + {{- $readme = partial "function/get-remote-json" (dict "URL" $readmeAPI "OPTIONS" $headers) -}} {{- end -}} {{- /* Skip if the repo info or README is not available */ -}} @@ -52,13 +52,19 @@ "lastmod" (time.AsTime $repoInfo.updated_at) -}} {{- /* Post params from repo info (equivalent to the front matter of posts) */ -}} + {{- $author := dict + "name" $repoInfo.owner.login + "link" $repoInfo.owner.html_url + "avatar" $repoInfo.owner.avatar_url + -}} {{- $params := dict "fromAdapters" "projects" + "author" $author "categories" $projectsAdapters.categories "collections" $projectsAdapters.collections "tags" $repoInfo.topics "lightgallery" true - "breadcrumb" (dict "capitalize" false) + "capitalizeTitles" false "toc" (dict "ordered" false) "subtitle" ($repoInfo.homepage | default $repoInfo.html_url) "sourceURL" (add $readme.html_url "?plain=1") diff --git a/content/zh-cn/components/_content.gotmpl b/content/zh-cn/components/_content.gotmpl index bb2e256..2e178bf 100644 --- a/content/zh-cn/components/_content.gotmpl +++ b/content/zh-cn/components/_content.gotmpl @@ -26,14 +26,14 @@ {{- end -}} {{- $projectsAdapters.ignoreList -}} {{- $repoAPI := printf "https://api.github.com/repos/%v" $repo -}} - {{- $repoInfo := partial "function/get-remote-json" (dict "URL" $repoAPI "OPTIONS" $headers ) -}} + {{- $repoInfo := partial "function/get-remote-json" (dict "URL" $repoAPI "OPTIONS" $headers) -}} {{- $readmeAPI := printf "https://api.github.com/repos/%v/contents/README.%v.md" $repo $.Site.Language.Lang -}} - {{- $readme := partial "function/get-remote-json" (dict "URL" $readmeAPI "OPTIONS" $headers ) -}} + {{- $readme := partial "function/get-remote-json" (dict "URL" $readmeAPI "OPTIONS" $headers) -}} {{- /* Get the default README if the multi-language README is not available */ -}} {{- if not $readme -}} {{- $readmeAPI = printf "https://api.github.com/repos/%v/readme" $repo -}} - {{- $readme = partial "function/get-remote-json" (dict "URL" $readmeAPI "OPTIONS" $headers ) -}} + {{- $readme = partial "function/get-remote-json" (dict "URL" $readmeAPI "OPTIONS" $headers) -}} {{- end -}} {{- /* Skip if the repo info or README is not available */ -}} @@ -52,13 +52,19 @@ "lastmod" (time.AsTime $repoInfo.updated_at) -}} {{- /* Post params from repo info (equivalent to the front matter of posts) */ -}} + {{- $author := dict + "name" $repoInfo.owner.login + "link" $repoInfo.owner.html_url + "avatar" $repoInfo.owner.avatar_url + -}} {{- $params := dict "fromAdapters" "projects" + "author" $author "categories" $projectsAdapters.categories "collections" $projectsAdapters.collections "tags" $repoInfo.topics "lightgallery" true - "breadcrumb" (dict "capitalize" false) + "capitalizeTitles" false "toc" (dict "ordered" false) "subtitle" ($repoInfo.homepage | default $repoInfo.html_url) "sourceURL" (add $readme.html_url "?plain=1") diff --git a/go.mod b/go.mod index 928b728..a94ae9b 100644 --- a/go.mod +++ b/go.mod @@ -3,8 +3,8 @@ module github.com/hugo-fixit/docs go 1.20 require ( - github.com/hugo-fixit/FixIt v0.3.13-0.20241001115042-e9edbba217d9 // indirect - github.com/hugo-fixit/component-projects v1.2.0 // indirect + github.com/hugo-fixit/FixIt v0.3.13-0.20241001175419-9c440df3d081 // indirect + github.com/hugo-fixit/component-projects v1.2.2 // indirect github.com/hugo-fixit/shortcode-caniuse v1.1.3 // indirect github.com/hugo-fixit/shortcode-rewards v1.0.4 // indirect ) diff --git a/go.sum b/go.sum index afa7604..5bfee7e 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,7 @@ -github.com/hugo-fixit/FixIt v0.3.13-0.20241001115042-e9edbba217d9 h1:0TXHvCynxnJRIaAnJ5oIcj0AHxKLQ3+WlSjNSsJkejc= -github.com/hugo-fixit/FixIt v0.3.13-0.20241001115042-e9edbba217d9/go.mod h1:3XIRedrqakO7/a4ZnhE46haMRF8HgsT0N0B5j5D2iRU= -github.com/hugo-fixit/component-projects v1.2.0 h1:CxAjX/tUsgbn9NivUnDqE4ocbawKGh8Bmb4PnTHMEjw= -github.com/hugo-fixit/component-projects v1.2.0/go.mod h1:nXW0R37REwpfwUD1I4RtB5QW71vw66nRyB9uEpYxr+c= +github.com/hugo-fixit/FixIt v0.3.13-0.20241001175419-9c440df3d081 h1:6DHB2n0WzNe+wa8ZbnS0aUb2+C5MS2ZKzJPKjDjYIAc= +github.com/hugo-fixit/FixIt v0.3.13-0.20241001175419-9c440df3d081/go.mod h1:3XIRedrqakO7/a4ZnhE46haMRF8HgsT0N0B5j5D2iRU= +github.com/hugo-fixit/component-projects v1.2.2 h1:s6Mm48B3N/qiM2mxLFeRKlrMSzK3mWh7Fw0r+8Q+a04= +github.com/hugo-fixit/component-projects v1.2.2/go.mod h1:nXW0R37REwpfwUD1I4RtB5QW71vw66nRyB9uEpYxr+c= github.com/hugo-fixit/shortcode-caniuse v1.1.3 h1:U1YBJz5SI/d1BBQhHcD0eVgJdCcpzK2usSizPiu+a4w= github.com/hugo-fixit/shortcode-caniuse v1.1.3/go.mod h1:RoPLFt+7uLui5rjvkC/qFGeo4nly5AzzwIID9SoDKNc= github.com/hugo-fixit/shortcode-rewards v1.0.4 h1:62qCmcGvAJf+qa+8ofRX6jwMUXo6Q4+PQvlOtu0ZGBA=