Skip to content

Commit

Permalink
Chore: 更新主题组件
Browse files Browse the repository at this point in the history
  • Loading branch information
Lruihao committed Oct 4, 2024
1 parent c0c89e4 commit 4af49a1
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
10 changes: 7 additions & 3 deletions content/en/components/_content.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
* @author Lruihao (https://lruihao.cn)
*/ -}}

{{- warnf "component-projects\n%v" (T "projects.warningAdapter") -}}
{{- $auth := dict "Authorization" "" -}}
{{- with (getenv "HUGO_PARAMS_GHTOKEN") -}}
{{- $auth = dict "Authorization" (printf "token %v" .) -}}
{{- end -}}
{{- $headers := dict "headers" $auth -}}
{{- $projectsAdapters := .Site.Params.projectsAdapters -}}
{{- $data := index .Site.Data (printf "projects.%v" .Site.Language.Lang) | default .Site.Data.projects -}}
{{- $renderedRepos := slice -}}

{{- /* Loop through the data and create a post for each repo */ -}}
{{- range $group := $data -}}
Expand All @@ -20,8 +22,8 @@
{{- break -}}
{{- end -}}
{{- range $repo := $group.repos -}}
{{- /* Ignore repos in the ignore list */ -}}
{{- if in $projectsAdapters.ignoreList $repo -}}
{{- /* Skip if the repo is in the ignore list or has been rendered */ -}}
{{- if (in $projectsAdapters.ignoreList $repo) | or (in $renderedRepos $repo) -}}
{{- continue -}}
{{- end -}}
{{- $projectsAdapters.ignoreList -}}
Expand All @@ -42,10 +44,12 @@
(not $readme) | or
(and $projectsAdapters.onlyPublic (eq $repoInfo.visibility "private"))
-}}
{{- warnidf "warning-projects-adapter" "Repo %v is not available or is private." $repo -}}
{{- continue -}}
{{- end -}}

{{- /* Add the repo to the rendered list */ -}}
{{- $renderedRepos = $renderedRepos | append $repo -}}

{{- /* Post dates from repo info */ -}}
{{- $dates := dict
"date" (time.AsTime $repoInfo.created_at)
Expand Down
10 changes: 7 additions & 3 deletions content/zh-cn/components/_content.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
* @author Lruihao (https://lruihao.cn)
*/ -}}

{{- warnf "component-projects\n%v" (T "projects.warningAdapter") -}}
{{- $auth := dict "Authorization" "" -}}
{{- with (getenv "HUGO_PARAMS_GHTOKEN") -}}
{{- $auth = dict "Authorization" (printf "token %v" .) -}}
{{- end -}}
{{- $headers := dict "headers" $auth -}}
{{- $projectsAdapters := .Site.Params.projectsAdapters -}}
{{- $data := index .Site.Data (printf "projects.%v" .Site.Language.Lang) | default .Site.Data.projects -}}
{{- $renderedRepos := slice -}}

{{- /* Loop through the data and create a post for each repo */ -}}
{{- range $group := $data -}}
Expand All @@ -20,8 +22,8 @@
{{- break -}}
{{- end -}}
{{- range $repo := $group.repos -}}
{{- /* Ignore repos in the ignore list */ -}}
{{- if in $projectsAdapters.ignoreList $repo -}}
{{- /* Skip if the repo is in the ignore list or has been rendered */ -}}
{{- if (in $projectsAdapters.ignoreList $repo) | or (in $renderedRepos $repo) -}}
{{- continue -}}
{{- end -}}
{{- $projectsAdapters.ignoreList -}}
Expand All @@ -42,10 +44,12 @@
(not $readme) | or
(and $projectsAdapters.onlyPublic (eq $repoInfo.visibility "private"))
-}}
{{- warnidf "warning-projects-adapter" "Repo %v is not available or is private." $repo -}}
{{- continue -}}
{{- end -}}

{{- /* Add the repo to the rendered list */ -}}
{{- $renderedRepos = $renderedRepos | append $repo -}}

{{- /* Post dates from repo info */ -}}
{{- $dates := dict
"date" (time.AsTime $repoInfo.created_at)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.20

require (
github.com/hugo-fixit/FixIt v0.3.13-0.20241003174054-95436c11ac09 // indirect
github.com/hugo-fixit/component-projects v1.2.4 // indirect
github.com/hugo-fixit/component-projects v1.2.5 // indirect
github.com/hugo-fixit/shortcode-caniuse v1.1.3 // indirect
github.com/hugo-fixit/shortcode-rewards v1.0.4 // indirect
)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
github.com/hugo-fixit/FixIt v0.3.13-0.20241003174054-95436c11ac09 h1:0IUNqDwVI8TCw0LIfewxT4hbWFetqkLQJYVz39AMBUk=
github.com/hugo-fixit/FixIt v0.3.13-0.20241003174054-95436c11ac09/go.mod h1:3XIRedrqakO7/a4ZnhE46haMRF8HgsT0N0B5j5D2iRU=
github.com/hugo-fixit/component-projects v1.2.4 h1:3LLTOYGHqhgAosPwbnNZbePFW/YCbXhMS4QN/F8ukXs=
github.com/hugo-fixit/component-projects v1.2.4/go.mod h1:nXW0R37REwpfwUD1I4RtB5QW71vw66nRyB9uEpYxr+c=
github.com/hugo-fixit/component-projects v1.2.5 h1:L1kCUtPcXg3ucLPqGrBTRJLIkCiiq7vWNUeMt0MPtb8=
github.com/hugo-fixit/component-projects v1.2.5/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=
Expand Down

0 comments on commit 4af49a1

Please sign in to comment.