{{- define "main" }} {{- /* 5 大分类配置 */ -}} {{- $categories := slice (dict "name" "Technology" "nameCN" "技术" "color" "#10b981" "icon" "gear" "description" "技术教程和开发实践" "tags" (slice "Go" "Kubernetes" "Docker" "Cloud Native" "DevOps" "AI" "LLM" "Microservices" "Git" "GitHub")) (dict "name" "Projects" "nameCN" "项目" "color" "#f43f5e" "icon" "heart" "description" "开源项目和 AI 实践" "tags" (slice "OpenIM" "Open Source" "LangChain" "AI Projects")) (dict "name" "Growth" "nameCN" "成长" "color" "#14b8a6" "icon" "leaf" "description" "个人成长和方法论" "tags" (slice "Annual Review" "Personal Growth" "Thinking" "Flow State" "GTD" "Metacognition")) (dict "name" "Travel" "nameCN" "旅行" "color" "#3b82f6" "icon" "cloud" "description" "旅行记录和见闻" "tags" (slice "Japan" "Lhasa" "Southeast Asia" "Cambodia" "Nepal" "Travel")) (dict "name" "Life" "nameCN" "生活" "color" "#8b5cf6" "icon" "users" "description" "生活感悟和兴趣爱好" "tags" (slice "English Learning" "Reading" "Self-Discovery" "Blog")) -}}
{{- range $categories }} {{- $categoryName := .name }} {{- $categoryNameCN := .nameCN }} {{- $color := .color }} {{- $icon := .icon }} {{- $description := .description }} {{- $tags := .tags }} {{- $categoryTotal := 0 }}
{{ $categoryName }} {{ $categoryNameCN }}
{{- /* 计算该分类下所有 tags 的文章总数 */ -}} {{- range $tags }} {{- $tagName := . }} {{- $tagPath := printf "/tags/%s/" ($tagName | urlize) }} {{- with $.Site.GetPage $tagPath }} {{- $categoryTotal = add $categoryTotal (len .Pages) }} {{- end }} {{- end }} {{ $categoryTotal }} 篇
{{- range $tags }} {{- $tagName := . }} {{- $tagPath := printf "/tags/%s/" ($tagName | urlize) }} {{- with $.Site.GetPage $tagPath }} {{ .Title }} {{- $count := len .Pages }} {{- if gt $count 0 }} {{ $count }} {{- end }} {{- else }} {{ $tagName }} {{- end }} {{- end }}
{{- end }}
{{- end }}