refactor: rename archive -> archives
This commit is contained in:
parent
c600f87213
commit
7379bbe412
@ -1,6 +1,6 @@
|
|||||||
.archive-group {
|
.archives-group {
|
||||||
margin-bottom: var(--section-separation);
|
margin-bottom: var(--section-separation);
|
||||||
.archive-date {
|
.archives-date {
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
font-size: 1.6rem;
|
font-size: 1.6rem;
|
||||||
@ -12,7 +12,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.template-archive {
|
.template-archives {
|
||||||
.category-list {
|
.category-list {
|
||||||
margin-bottom: var(--section-separation);
|
margin-bottom: var(--section-separation);
|
||||||
overflow-x: auto;
|
overflow-x: auto;
|
@ -43,9 +43,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Archive widget */
|
/* Archives widget */
|
||||||
.widget.archive {
|
.widget.archives {
|
||||||
.archive-year {
|
.archives-year {
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
a {
|
a {
|
||||||
background-color: var(--card-background);
|
background-color: var(--card-background);
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
@import "partials/pagination.scss";
|
@import "partials/pagination.scss";
|
||||||
@import "partials/sidebar.scss";
|
@import "partials/sidebar.scss";
|
||||||
@import "partials/base.scss";
|
@import "partials/base.scss";
|
||||||
@import "partials/layout/archive.scss";
|
@import "partials/layout/archives.scss";
|
||||||
@import "partials/layout/article.scss";
|
@import "partials/layout/article.scss";
|
||||||
@import "partials/layout/taxonomy.scss";
|
@import "partials/layout/taxonomy.scss";
|
||||||
@import "partials/layout/404.scss";
|
@import "partials/layout/404.scss";
|
||||||
|
@ -29,11 +29,11 @@ DefaultContentLanguage = "en" # Theme i18n support
|
|||||||
# Only Disqus is available so far
|
# Only Disqus is available so far
|
||||||
provider = "disqus"
|
provider = "disqus"
|
||||||
[params.widgets]
|
[params.widgets]
|
||||||
enabled = ['archive', 'tag-cloud']
|
enabled = ['archives', 'tag-cloud']
|
||||||
[params.widgets.archive]
|
[params.widgets.archives]
|
||||||
limit = 5
|
limit = 5
|
||||||
### Archive page relative URL
|
### Archives page relative URL
|
||||||
path = "archive"
|
path = "archives"
|
||||||
[params.widgets.tagCloud]
|
[params.widgets.tagCloud]
|
||||||
limit = 10
|
limit = 10
|
||||||
[params.opengraph]
|
[params.opengraph]
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
---
|
|
||||||
title: "Archive"
|
|
||||||
date: 2019-05-28
|
|
||||||
layout: "archive"
|
|
||||||
slug: "archive"
|
|
||||||
---
|
|
6
exampleSite/content/page/archives.md
Normal file
6
exampleSite/content/page/archives.md
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
title: "Archives"
|
||||||
|
date: 2019-05-28
|
||||||
|
layout: "archives"
|
||||||
|
slug: "archives"
|
||||||
|
---
|
@ -7,10 +7,10 @@
|
|||||||
[lastUpdatedOn]
|
[lastUpdatedOn]
|
||||||
other ="Last updated on {{ .Count }}"
|
other ="Last updated on {{ .Count }}"
|
||||||
|
|
||||||
[widgetArchiveTitle]
|
[widgetArchivesTitle]
|
||||||
other = "Archive"
|
other = "Archives"
|
||||||
|
|
||||||
[widgetArchiveMore]
|
[widgetArchivesMore]
|
||||||
other = "More"
|
other = "More"
|
||||||
|
|
||||||
[widgetTagCloudTitle]
|
[widgetTagCloudTitle]
|
||||||
|
@ -7,10 +7,10 @@
|
|||||||
[lastUpdatedOn]
|
[lastUpdatedOn]
|
||||||
other ="最后更新于 {{ .Count }}"
|
other ="最后更新于 {{ .Count }}"
|
||||||
|
|
||||||
[widgetArchiveTitle]
|
[widgetArchivesTitle]
|
||||||
other = "归档"
|
other = "归档"
|
||||||
|
|
||||||
[widgetArchiveMore]
|
[widgetArchivesMore]
|
||||||
other = "更多"
|
other = "更多"
|
||||||
|
|
||||||
[widgetTagCloudTitle]
|
[widgetTagCloudTitle]
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{{ define "body-class" }}template-archive{{ end }}
|
{{ define "body-class" }}template-archives{{ end }}
|
||||||
{{ define "main" }}
|
{{ define "main" }}
|
||||||
{{ $categories := ($.Site.GetPage "taxonomyTerm" "categories").Pages }}
|
{{ $categories := ($.Site.GetPage "taxonomyTerm" "categories").Pages }}
|
||||||
{{ if $categories }}
|
{{ if $categories }}
|
||||||
@ -20,8 +20,8 @@
|
|||||||
|
|
||||||
{{ range $filtered.GroupByDate "2006" }}
|
{{ range $filtered.GroupByDate "2006" }}
|
||||||
{{ $id := lower (replace .Key " " "-") }}
|
{{ $id := lower (replace .Key " " "-") }}
|
||||||
<div class="archive-group" id="{{ $id }}">
|
<div class="archives-group" id="{{ $id }}">
|
||||||
<h3 class="archive-date"><a href="{{ $.Permalink }}#{{ $id }}">{{ .Key }}</a></h3>
|
<h3 class="archives-date"><a href="{{ $.Permalink }}#{{ $id }}">{{ .Key }}</a></h3>
|
||||||
<div class="article-list--compact">
|
<div class="article-list--compact">
|
||||||
{{ range .Pages }}
|
{{ range .Pages }}
|
||||||
{{ partial "article-list/compact" . }}
|
{{ partial "article-list/compact" . }}
|
@ -1,28 +1,28 @@
|
|||||||
<section class="widget archive">
|
<section class="widget archives">
|
||||||
<div class="widget-icon">
|
<div class="widget-icon">
|
||||||
{{ (resources.Get "icons/infinity.svg").Content | safeHTML }}
|
{{ (resources.Get "icons/infinity.svg").Content | safeHTML }}
|
||||||
</div>
|
</div>
|
||||||
<h1 class="widget-title">{{ T "widgetArchiveTitle" }}</h1>
|
<h1 class="widget-title">{{ T "widgetArchivesTitle" }}</h1>
|
||||||
|
|
||||||
{{ $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }}
|
{{ $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }}
|
||||||
{{ $notHidden := where .Site.RegularPages "Params.hidden" "!=" true }}
|
{{ $notHidden := where .Site.RegularPages "Params.hidden" "!=" true }}
|
||||||
{{ $filtered := ($pages | intersect $notHidden) }}
|
{{ $filtered := ($pages | intersect $notHidden) }}
|
||||||
{{ $archive := $filtered.GroupByDate "2006" }}
|
{{ $archives := $filtered.GroupByDate "2006" }}
|
||||||
|
|
||||||
{{ range first .Site.Params.widgets.archive.limit ($archive) }}
|
{{ range first .Site.Params.widgets.archives.limit ($archives) }}
|
||||||
{{ $id := lower (replace .Key " " "-") }}
|
{{ $id := lower (replace .Key " " "-") }}
|
||||||
<div class="archive-year">
|
<div class="archives-year">
|
||||||
<a href="{{ $.Site.Params.widgets.archive.path | relLangURL }}#{{ $id }}">
|
<a href="{{ $.Site.Params.widgets.archives.path | relLangURL }}#{{ $id }}">
|
||||||
<span class="year">{{ .Key }}</span>
|
<span class="year">{{ .Key }}</span>
|
||||||
<span class="count">{{ len .Pages }}</span>
|
<span class="count">{{ len .Pages }}</span>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ if gt (len $archive) .Site.Params.widgets.archive.limit }}
|
{{ if gt (len $archives) .Site.Params.widgets.archives.limit }}
|
||||||
<div class="archive-year">
|
<div class="archives-year">
|
||||||
<a href="{{ $.Site.Params.widgets.archive.path | relLangURL }}">
|
<a href="{{ $.Site.Params.widgets.archives.path | relLangURL }}">
|
||||||
<span class="year">{{ T "widgetArchiveMore" }}</span>
|
<span class="year">{{ T "widgetArchivesMore" }}</span>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
{{ end }}
|
{{ end }}
|
Loading…
Reference in New Issue
Block a user