From 7379bbe412fcc0d61a6980e787da66526d8ee17d Mon Sep 17 00:00:00 2001 From: Jimmy Cai Date: Sun, 13 Sep 2020 11:22:47 +0200 Subject: refactor: rename archive -> archives --- assets/scss/partials/layout/archive.scss | 41 ------------------------------- assets/scss/partials/layout/archives.scss | 41 +++++++++++++++++++++++++++++++ assets/scss/partials/widgets.scss | 6 ++--- assets/scss/style.scss | 2 +- exampleSite/config.toml | 8 +++--- exampleSite/content/page/archive.md | 6 ----- exampleSite/content/page/archives.md | 6 +++++ i18n/en.toml | 6 ++--- i18n/zh-CN.toml | 4 +-- layouts/_default/archive.html | 34 ------------------------- layouts/_default/archives.html | 34 +++++++++++++++++++++++++ layouts/partials/widget/archive.html | 29 ---------------------- layouts/partials/widget/archives.html | 29 ++++++++++++++++++++++ 13 files changed, 123 insertions(+), 123 deletions(-) delete mode 100644 assets/scss/partials/layout/archive.scss create mode 100644 assets/scss/partials/layout/archives.scss delete mode 100644 exampleSite/content/page/archive.md create mode 100644 exampleSite/content/page/archives.md delete mode 100644 layouts/_default/archive.html create mode 100644 layouts/_default/archives.html delete mode 100644 layouts/partials/widget/archive.html create mode 100644 layouts/partials/widget/archives.html diff --git a/assets/scss/partials/layout/archive.scss b/assets/scss/partials/layout/archive.scss deleted file mode 100644 index ec3b456..0000000 --- a/assets/scss/partials/layout/archive.scss +++ /dev/null @@ -1,41 +0,0 @@ -.archive-group { - margin-bottom: var(--section-separation); - .archive-date { - text-transform: uppercase; - margin-bottom: 10px; - font-size: 1.6rem; - font-weight: bold; - - a { - color: var(--body-text-color); - } - } -} - -.template-archive { - .category-list { - margin-bottom: var(--section-separation); - overflow-x: auto; - - .article-list--tile { - display: flex; - padding-bottom: 15px; - - article { - width: 250px; - height: 150px; - margin-right: 20px; - flex-shrink: 0; - - .article-title { - margin: 0; - font-size: 1.8rem; - } - - .article-details { - padding: 20px; - } - } - } - } -} diff --git a/assets/scss/partials/layout/archives.scss b/assets/scss/partials/layout/archives.scss new file mode 100644 index 0000000..569348e --- /dev/null +++ b/assets/scss/partials/layout/archives.scss @@ -0,0 +1,41 @@ +.archives-group { + margin-bottom: var(--section-separation); + .archives-date { + text-transform: uppercase; + margin-bottom: 10px; + font-size: 1.6rem; + font-weight: bold; + + a { + color: var(--body-text-color); + } + } +} + +.template-archives { + .category-list { + margin-bottom: var(--section-separation); + overflow-x: auto; + + .article-list--tile { + display: flex; + padding-bottom: 15px; + + article { + width: 250px; + height: 150px; + margin-right: 20px; + flex-shrink: 0; + + .article-title { + margin: 0; + font-size: 1.8rem; + } + + .article-details { + padding: 20px; + } + } + } + } +} diff --git a/assets/scss/partials/widgets.scss b/assets/scss/partials/widgets.scss index 3874e7d..c80c8ad 100644 --- a/assets/scss/partials/widgets.scss +++ b/assets/scss/partials/widgets.scss @@ -43,9 +43,9 @@ } } -/* Archive widget */ -.widget.archive { - .archive-year { +/* Archives widget */ +.widget.archives { + .archives-year { margin-bottom: 10px; a { background-color: var(--card-background); diff --git a/assets/scss/style.scss b/assets/scss/style.scss index 44a45ce..908be5e 100644 --- a/assets/scss/style.scss +++ b/assets/scss/style.scss @@ -18,7 +18,7 @@ @import "partials/pagination.scss"; @import "partials/sidebar.scss"; @import "partials/base.scss"; -@import "partials/layout/archive.scss"; +@import "partials/layout/archives.scss"; @import "partials/layout/article.scss"; @import "partials/layout/taxonomy.scss"; @import "partials/layout/404.scss"; diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 64039df..137ea8c 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -29,11 +29,11 @@ DefaultContentLanguage = "en" # Theme i18n support # Only Disqus is available so far provider = "disqus" [params.widgets] - enabled = ['archive', 'tag-cloud'] - [params.widgets.archive] + enabled = ['archives', 'tag-cloud'] + [params.widgets.archives] limit = 5 - ### Archive page relative URL - path = "archive" + ### Archives page relative URL + path = "archives" [params.widgets.tagCloud] limit = 10 [params.opengraph] diff --git a/exampleSite/content/page/archive.md b/exampleSite/content/page/archive.md deleted file mode 100644 index 7c51bea..0000000 --- a/exampleSite/content/page/archive.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: "Archive" -date: 2019-05-28 -layout: "archive" -slug: "archive" ---- diff --git a/exampleSite/content/page/archives.md b/exampleSite/content/page/archives.md new file mode 100644 index 0000000..e25595b --- /dev/null +++ b/exampleSite/content/page/archives.md @@ -0,0 +1,6 @@ +--- +title: "Archives" +date: 2019-05-28 +layout: "archives" +slug: "archives" +--- diff --git a/i18n/en.toml b/i18n/en.toml index 61c5e4a..7f2036e 100644 --- a/i18n/en.toml +++ b/i18n/en.toml @@ -7,10 +7,10 @@ [lastUpdatedOn] other ="Last updated on {{ .Count }}" -[widgetArchiveTitle] - other = "Archive" +[widgetArchivesTitle] + other = "Archives" -[widgetArchiveMore] +[widgetArchivesMore] other = "More" [widgetTagCloudTitle] diff --git a/i18n/zh-CN.toml b/i18n/zh-CN.toml index 44a76c5..d8852e4 100644 --- a/i18n/zh-CN.toml +++ b/i18n/zh-CN.toml @@ -7,10 +7,10 @@ [lastUpdatedOn] other ="最后更新于 {{ .Count }}" -[widgetArchiveTitle] +[widgetArchivesTitle] other = "归档" -[widgetArchiveMore] +[widgetArchivesMore] other = "更多" [widgetTagCloudTitle] diff --git a/layouts/_default/archive.html b/layouts/_default/archive.html deleted file mode 100644 index b68e40a..0000000 --- a/layouts/_default/archive.html +++ /dev/null @@ -1,34 +0,0 @@ -{{ define "body-class" }}template-archive{{ end }} -{{ define "main" }} - {{ $categories := ($.Site.GetPage "taxonomyTerm" "categories").Pages }} - {{ if $categories }} -
-

Categories

-
-
- {{ range $categories }} - {{ partial "article-list/tile" (dict "context" . "size" "250x150") }} - {{ end }} -
-
-
- {{ end }} - - {{ $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }} - {{ $notHidden := where .Site.RegularPages "Params.hidden" "!=" true }} - {{ $filtered := ($pages | intersect $notHidden) }} - - {{ range $filtered.GroupByDate "2006" }} - {{ $id := lower (replace .Key " " "-") }} -
-

{{ .Key }}

-
- {{ range .Pages }} - {{ partial "article-list/compact" . }} - {{ end }} -
-
- {{ end }} - - {{ partialCached "footer/footer" . }} -{{ end }} \ No newline at end of file diff --git a/layouts/_default/archives.html b/layouts/_default/archives.html new file mode 100644 index 0000000..18b3f6c --- /dev/null +++ b/layouts/_default/archives.html @@ -0,0 +1,34 @@ +{{ define "body-class" }}template-archives{{ end }} +{{ define "main" }} + {{ $categories := ($.Site.GetPage "taxonomyTerm" "categories").Pages }} + {{ if $categories }} +
+

Categories

+
+
+ {{ range $categories }} + {{ partial "article-list/tile" (dict "context" . "size" "250x150") }} + {{ end }} +
+
+
+ {{ end }} + + {{ $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }} + {{ $notHidden := where .Site.RegularPages "Params.hidden" "!=" true }} + {{ $filtered := ($pages | intersect $notHidden) }} + + {{ range $filtered.GroupByDate "2006" }} + {{ $id := lower (replace .Key " " "-") }} +
+

{{ .Key }}

+
+ {{ range .Pages }} + {{ partial "article-list/compact" . }} + {{ end }} +
+
+ {{ end }} + + {{ partialCached "footer/footer" . }} +{{ end }} \ No newline at end of file diff --git a/layouts/partials/widget/archive.html b/layouts/partials/widget/archive.html deleted file mode 100644 index 1dae730..0000000 --- a/layouts/partials/widget/archive.html +++ /dev/null @@ -1,29 +0,0 @@ -
-
- {{ (resources.Get "icons/infinity.svg").Content | safeHTML }} -
-

{{ T "widgetArchiveTitle" }}

- - {{ $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }} - {{ $notHidden := where .Site.RegularPages "Params.hidden" "!=" true }} - {{ $filtered := ($pages | intersect $notHidden) }} - {{ $archive := $filtered.GroupByDate "2006" }} - - {{ range first .Site.Params.widgets.archive.limit ($archive) }} - {{ $id := lower (replace .Key " " "-") }} - - {{ end }} - - {{ if gt (len $archive) .Site.Params.widgets.archive.limit }} - - {{ end }} -
diff --git a/layouts/partials/widget/archives.html b/layouts/partials/widget/archives.html new file mode 100644 index 0000000..de80ee5 --- /dev/null +++ b/layouts/partials/widget/archives.html @@ -0,0 +1,29 @@ +
+
+ {{ (resources.Get "icons/infinity.svg").Content | safeHTML }} +
+

{{ T "widgetArchivesTitle" }}

+ + {{ $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }} + {{ $notHidden := where .Site.RegularPages "Params.hidden" "!=" true }} + {{ $filtered := ($pages | intersect $notHidden) }} + {{ $archives := $filtered.GroupByDate "2006" }} + + {{ range first .Site.Params.widgets.archives.limit ($archives) }} + {{ $id := lower (replace .Key " " "-") }} + + {{ end }} + + {{ if gt (len $archives) .Site.Params.widgets.archives.limit }} + + {{ end }} +
-- cgit v1.2.3