fix: inline stack theme

This commit is contained in:
2026-07-31 15:38:57 +08:00
parent b59ffa7703
commit 3423112533
335 changed files with 16340 additions and 1 deletions
@@ -0,0 +1,37 @@
{{- $query := first 1 (where .Context.Site.Pages "Layout" "==" "archives") -}}
{{- $context := .Context -}}
{{- $limit := default 5 .Params.limit -}}
{{- if $query -}}
{{- $archivesPage := index $query 0 -}}
<section class="widget archives">
<div class="widget-icon">
{{ partial "helper/icon" "infinity" }}
</div>
<h2 class="widget-title section-title">
<a href="{{ $archivesPage.RelPermalink }}">
{{ T "widget.archives.title" }}
</a>
</h2>
{{ $pages := partial "helper/pages.html" $context.Site.Home }}
{{ $archives := $pages.GroupByDate "2006" }}
<div class="widget-archive--list">
{{ range $index, $item := first (add $limit 1) ($archives) }}
{{- $id := lower (replace $item.Key " " "-") -}}
<div class="archives-year">
<a href="{{ $archivesPage.RelPermalink }}#{{ $id }}">
{{ if eq $index $limit }}
<span class="year">{{ T "widget.archives.more" }}</span>
{{ else }}
<span class="year">{{ .Key }}</span>
<span class="count">{{ len $item.Pages }}</span>
{{ end }}
</a>
</div>
{{ end }}
</div>
</section>
{{- else -}}
{{- warnf "Archives page not found. Create a page with layout: archives." -}}
{{- end -}}
@@ -0,0 +1,2 @@
{{ $params := merge (dict "taxonomy" "categories" "title" (T "widget.categoriesCloud.title") "icon" "categories") .Params }}
{{ partial "widget/taxonomy" (dict "Context" .Context "Params" $params) }}
@@ -0,0 +1,16 @@
{{- $query := first 1 (where .Context.Site.Pages "Layout" "==" "search") -}}
{{- if $query -}}
{{- $searchPage := index $query 0 -}}
<form action="{{ $searchPage.RelPermalink }}" class="search-form widget" {{ with .OutputFormats.Get "json" -}}data-json="{{ .RelPermalink }}" {{- end }}>
<p>
<label>{{ T "search.title" }}</label>
<input name="keyword" required placeholder="{{ T `search.placeholder` }}" />
<button title="{{ T `search.title` }}">
{{ partial "helper/icon" "search" }}
</button>
</p>
</form>
{{- else -}}
{{- warnf "Search page not found. Create a page with layout: search." -}}
{{- end -}}
@@ -0,0 +1,2 @@
{{ $params := merge (dict "taxonomy" "tags" "title" (T "widget.tagCloud.title") "icon" "tag") .Params }}
{{ partial "widget/taxonomy" (dict "Context" .Context "Params" $params) }}
@@ -0,0 +1,39 @@
{{- $context := .Context -}}
{{- if not .Params.taxonomy -}}
{{- warnf "Taxonomy field is required" -}}
{{- end -}}
{{- $taxonomy := index $context.Site.Taxonomies .Params.taxonomy -}}
{{- if not $taxonomy -}}
{{- warnf "Taxonomy %s not found" .Params.taxonomy -}}
{{- end -}}
{{- $taxonomyPage := $taxonomy.Page -}}
{{- $widgetTitle := .Params.title -}}
{{- $limit := default 10 .Params.limit -}}
{{- $icon := default .Params.taxonomy .Params.icon -}}
{{- $showLink := default true .Params.showLink -}}
<section class="widget tagCloud">
<div class="widget-icon">
{{ partial "helper/icon" $icon }}
</div>
<h2 class="widget-title section-title">
{{ if and $showLink $taxonomyPage }}
<a href="{{ $taxonomyPage.RelPermalink }}">
{{ $widgetTitle }}
</a>
{{ else }}
{{ $widgetTitle }}
{{ end }}
</h2>
<div class="tagCloud-tags">
{{ range first $limit $taxonomy.ByCount }}
<a href="{{ .Page.RelPermalink }}">
{{ .Page.Title }}
</a>
{{ end }}
</div>
</section>
@@ -0,0 +1,14 @@
{{ if (.Context.Scratch.Get "TOCEnabled") }}
<section class="widget archives">
<div class="widget-icon">
{{ partial "helper/icon" "hash" }}
</div>
<h2 class="widget-title section-title">{{ T "article.tableOfContents" }}</h2>
<div class="widget--toc">
<nav class="toc-nav" id="TableOfContents">
{{ partial "article/components/toc" .Context | safeHTML }}
</nav>
</div>
</section>
{{ end }}