mirror of
https://github.com/CaiJimmy/hugo-theme-stack.git
synced 2025-04-29 03:53:30 +08:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
4094233034
@ -9,6 +9,8 @@ class StackColorScheme {
|
||||
this.bindMatchMedia();
|
||||
this.currentScheme = this.getSavedScheme();
|
||||
|
||||
this.dispatchEvent(document.body.dataset.scheme as colorScheme);
|
||||
|
||||
if (toggleEl)
|
||||
this.bindClick(toggleEl);
|
||||
|
||||
|
@ -60,7 +60,6 @@ params:
|
||||
|
||||
archives:
|
||||
limit: 5
|
||||
path: archives
|
||||
|
||||
tagCloud:
|
||||
limit: 10
|
||||
@ -82,7 +81,7 @@ params:
|
||||
colorScheme:
|
||||
# Display toggle
|
||||
toggle: true
|
||||
|
||||
|
||||
# Available values: auto, light, dark
|
||||
default: auto
|
||||
|
||||
|
@ -16,10 +16,6 @@ list:
|
||||
one: Subsection
|
||||
other: Subsections
|
||||
|
||||
archives:
|
||||
categories:
|
||||
other: Categories
|
||||
|
||||
article:
|
||||
relatedContents:
|
||||
other: Related contents
|
||||
|
@ -4,10 +4,6 @@ toggleMenu:
|
||||
darkMode:
|
||||
other: ダークモード
|
||||
|
||||
archives:
|
||||
categories:
|
||||
other: 分類
|
||||
|
||||
article:
|
||||
relatedContents:
|
||||
other: 関連するコンテンツ
|
||||
|
@ -1,9 +1,20 @@
|
||||
toggleMenu:
|
||||
other: Alternar Menu
|
||||
|
||||
archives:
|
||||
categories:
|
||||
other: Categorias
|
||||
darkMode:
|
||||
other: Modo Escuro
|
||||
|
||||
list:
|
||||
page:
|
||||
one: "{{ .Count }} página"
|
||||
other: "{{ .Count }} páginas"
|
||||
|
||||
section:
|
||||
other: Seção
|
||||
|
||||
subsection:
|
||||
one: Subseção
|
||||
other: Subseções
|
||||
|
||||
article:
|
||||
relatedContents:
|
||||
|
16
i18n/ru.yaml
16
i18n/ru.yaml
@ -12,17 +12,13 @@ list:
|
||||
other: "{{ .Count }} страниц"
|
||||
|
||||
section:
|
||||
other: Разделы
|
||||
other: Раздел
|
||||
|
||||
subsection:
|
||||
one: Подраздел
|
||||
few: Подраздела
|
||||
many: Подразделов
|
||||
other: Подразделов
|
||||
|
||||
archives:
|
||||
categories:
|
||||
other: Категории
|
||||
few: Подразделы
|
||||
many: Подразделы
|
||||
other: Подразделы
|
||||
|
||||
article:
|
||||
relatedContents:
|
||||
@ -32,7 +28,7 @@ article:
|
||||
|
||||
notFound:
|
||||
title:
|
||||
other: Не найшено
|
||||
other: Не найдено
|
||||
subtitle:
|
||||
other: Запрашиваемая страница не существует
|
||||
|
||||
@ -58,4 +54,4 @@ footer:
|
||||
builtWith:
|
||||
other: Создано при помощи {{ .Generator }}
|
||||
designedBy:
|
||||
other: Тема {{ .Theme }} дизайн {{ .DesignedBy }}
|
||||
other: Тема {{ .Theme }}, дизайн {{ .DesignedBy }}
|
||||
|
@ -16,10 +16,6 @@ list:
|
||||
one: Alt bölüm
|
||||
other: Alt bölümler
|
||||
|
||||
archives:
|
||||
categories:
|
||||
other: Kategoriler
|
||||
|
||||
article:
|
||||
relatedContents:
|
||||
other: Alakalı içerikler
|
||||
|
@ -4,10 +4,6 @@ toggleMenu:
|
||||
darkMode:
|
||||
other: 暗色模式
|
||||
|
||||
archives:
|
||||
categories:
|
||||
other: 分类
|
||||
|
||||
article:
|
||||
relatedContents:
|
||||
other: 相关文章
|
||||
|
@ -1,11 +1,12 @@
|
||||
{{ define "body-class" }}template-archives{{ end }}
|
||||
{{ define "main" }}
|
||||
{{ $categories := ($.Site.GetPage "taxonomyTerm" "categories").Pages }}
|
||||
{{ if $categories }}
|
||||
<h2 class="section-title">{{ T "archives.categories" }}</h2>
|
||||
{{- $taxonomy := $.Site.GetPage "taxonomyTerm" "categories" -}}
|
||||
{{- $terms := $taxonomy.Pages -}}
|
||||
{{ if $terms }}
|
||||
<h2 class="section-title">{{ $taxonomy.Title }}</h2>
|
||||
<div class="subsection-list">
|
||||
<div class="article-list--tile">
|
||||
{{ range $categories }}
|
||||
{{ range $terms }}
|
||||
{{ partial "article-list/tile" (dict "context" . "size" "250x150" "Type" "taxonomy") }}
|
||||
{{ end }}
|
||||
</div>
|
||||
|
@ -42,8 +42,17 @@
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
{{ $subsections := .Sections }}
|
||||
{{ with $subsections }}
|
||||
{{- $subsections := .Sections -}}
|
||||
{{- $pages := .Pages | complement $subsections -}}
|
||||
|
||||
{{- if eq (len $pages) 0 -}}
|
||||
{{/* If there are no normal pages, display subsections in list style, with pagination */}}
|
||||
{{/* This happens with taxonomies like categories or tags */}}
|
||||
{{- $pages = $subsections -}}
|
||||
{{- $subsections = slice -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- with $subsections -}}
|
||||
<h2 class="section-title">{{ T "list.subsection" (len $subsections) }}</h2>
|
||||
<div class="subsection-list">
|
||||
<div class="article-list--tile">
|
||||
@ -52,10 +61,10 @@
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
{{- end -}}
|
||||
|
||||
{{/* List only pages that are not a subsection */}}
|
||||
{{ $paginator := .Paginate (.Pages | complement $subsections) }}
|
||||
{{ $paginator := .Paginate $pages }}
|
||||
<section class="article-list--compact">
|
||||
{{ range $paginator.Pages }}
|
||||
{{ partial "article-list/compact" . }}
|
||||
|
@ -11,7 +11,7 @@
|
||||
<input name="keyword" placeholder="{{ T `search.placeholder` }}" />
|
||||
</p>
|
||||
|
||||
<button title="Search">
|
||||
<button title="{{ T `search.title` }}">
|
||||
{{ partial "helper/icon" "search" }}
|
||||
</button>
|
||||
</form>
|
||||
|
@ -10,3 +10,13 @@
|
||||
padding: var(--card-padding);
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
window.addEventListener('onColorSchemeChange', (e) => {
|
||||
if (DISQUS) {
|
||||
DISQUS.reset({
|
||||
reload: true
|
||||
});
|
||||
}
|
||||
})
|
||||
</script>
|
@ -13,4 +13,19 @@
|
||||
.utterances {
|
||||
max-width: unset;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
<script>
|
||||
window.addEventListener('onColorSchemeChange', (e) => {
|
||||
let utterances = document.querySelector('.utterances iframe');
|
||||
if (utterances) {
|
||||
utterances.contentWindow.postMessage(
|
||||
{
|
||||
type: 'set-theme',
|
||||
theme: `github-${e.detail}`
|
||||
},
|
||||
'https://utteranc.es'
|
||||
);
|
||||
}
|
||||
})
|
||||
</script>
|
@ -1,27 +1,33 @@
|
||||
<section class="widget archives">
|
||||
<div class="widget-icon">
|
||||
{{ partial "helper/icon" "infinity" }}
|
||||
</div>
|
||||
<h2 class="widget-title section-title">{{ T "widget.archives.title" }}</h2>
|
||||
{{- $query := first 1 (where .Site.Pages "Layout" "==" "archives") -}}
|
||||
{{- 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">{{ T "widget.archives.title" }}</h2>
|
||||
|
||||
{{ $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }}
|
||||
{{ $notHidden := where .Site.RegularPages "Params.hidden" "!=" true }}
|
||||
{{ $filtered := ($pages | intersect $notHidden) }}
|
||||
{{ $archives := $filtered.GroupByDate "2006" }}
|
||||
|
||||
<div class="widget-archive--list">
|
||||
{{ range $index, $item := first (add .Site.Params.widgets.archives.limit 1) ($archives) }}
|
||||
{{- $id := lower (replace $item.Key " " "-") -}}
|
||||
<div class="archives-year">
|
||||
<a href="{{ $.Site.Params.widgets.archives.path | relLangURL }}#{{ $id }}">
|
||||
{{ if eq $index $.Site.Params.widgets.archives.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>
|
||||
{{ $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }}
|
||||
{{ $notHidden := where .Site.RegularPages "Params.hidden" "!=" true }}
|
||||
{{ $filtered := ($pages | intersect $notHidden) }}
|
||||
{{ $archives := $filtered.GroupByDate "2006" }}
|
||||
|
||||
<div class="widget-archive--list">
|
||||
{{ range $index, $item := first (add .Site.Params.widgets.archives.limit 1) ($archives) }}
|
||||
{{- $id := lower (replace $item.Key " " "-") -}}
|
||||
<div class="archives-year">
|
||||
<a href="{{ $archivesPage.RelPermalink }}#{{ $id }}">
|
||||
{{ if eq $index $.Site.Params.widgets.archives.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 -}}
|
@ -1,10 +1,16 @@
|
||||
<form action="/search" class="search-form widget" {{ with .OutputFormats.Get "json" -}}data-json="{{ .Permalink }}" {{- end }}>
|
||||
<p>
|
||||
<label>{{ T "search.title" }}</label>
|
||||
<input name="keyword" required placeholder="{{ T `search.placeholder` }}" />
|
||||
|
||||
<button title="Search">
|
||||
{{ partial "helper/icon" "search" }}
|
||||
</button>
|
||||
</p>
|
||||
</form>
|
||||
{{- $query := first 1 (where .Site.Pages "Layout" "==" "search") -}}
|
||||
{{- if $query -}}
|
||||
{{- $searchPage := index $query 0 -}}
|
||||
<form action="{{ $searchPage.RelPermalink }}" class="search-form widget" {{ with .OutputFormats.Get "json" -}}data-json="{{ .Permalink }}" {{- 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 -}}
|
Loading…
Reference in New Issue
Block a user