diff --git a/content/en/components/_content.gotmpl b/content/en/components/_content.gotmpl index 4e5ceb2..ca7a2fc 100644 --- a/content/en/components/_content.gotmpl +++ b/content/en/components/_content.gotmpl @@ -5,6 +5,7 @@ * @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" .) -}} @@ -12,6 +13,7 @@ {{- $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 -}} @@ -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 -}} @@ -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) diff --git a/content/zh-cn/components/_content.gotmpl b/content/zh-cn/components/_content.gotmpl index 4e5ceb2..ca7a2fc 100644 --- a/content/zh-cn/components/_content.gotmpl +++ b/content/zh-cn/components/_content.gotmpl @@ -5,6 +5,7 @@ * @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" .) -}} @@ -12,6 +13,7 @@ {{- $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 -}} @@ -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 -}} @@ -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) diff --git a/go.mod b/go.mod index 67452fa..cb81dea 100644 --- a/go.mod +++ b/go.mod @@ -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 ) diff --git a/go.sum b/go.sum index b8e08de..40dbc5a 100644 --- a/go.sum +++ b/go.sum @@ -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=