Merge pull request #5 from CaiJimmy/master

Update
This commit is contained in:
Daniel Pessoa 2021-01-01 18:59:07 -03:00 committed by GitHub
commit d1d0616097
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 81 additions and 68 deletions

View File

@ -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

View File

@ -16,10 +16,6 @@ list:
one: Subsection
other: Subsections
archives:
categories:
other: Categories
article:
relatedContents:
other: Related contents

View File

@ -4,10 +4,6 @@ toggleMenu:
darkMode:
other: ダークモード
archives:
categories:
other: 分類
article:
relatedContents:
other: 関連するコンテンツ

View File

@ -1,10 +1,6 @@
toggleMenu:
other: Alternar Menu
archives:
categories:
other: Categorias
article:
relatedContents:
other: Conteúdos Relacionados

View File

@ -20,10 +20,6 @@ list:
many: Подразделов
other: Подразделов
archives:
categories:
other: Категории
article:
relatedContents:
other: Также рекомендуем

View File

@ -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

View File

@ -4,10 +4,6 @@ toggleMenu:
darkMode:
other: 暗色模式
archives:
categories:
other: 分类
article:
relatedContents:
other: 相关文章

View File

@ -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>

View File

@ -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>

View File

@ -10,3 +10,13 @@
padding: var(--card-padding);
}
</style>
<script>
window.addEventListener('onColorSchemeChange', (e) => {
if (DISQUS) {
DISQUS.reset({
reload: true
});
}
})
</script>

View File

@ -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>

View File

@ -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 -}}

View File

@ -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 -}}