From c7e401969102c1c66d8492a0e314d1b71f48223e Mon Sep 17 00:00:00 2001 From: zilch40 Date: Sat, 14 Nov 2020 23:37:40 +0800 Subject: forgot a lot of files in last commit XD --- README.md | 11 ++- assets/css/common.scss | 3 +- i18n/en.toml | 23 +++++++ i18n/zh-cn.toml | 23 +++++++ layouts/_default/baseof.html | 3 +- layouts/_default/taxonomy.html | 55 ++++++++------- layouts/archives/single.html | 30 ++++----- layouts/partials/footer.html | 4 ++ layouts/partials/header.html | 5 +- layouts/partials/nav.html | 49 ++++---------- layouts/partials/navburger.html | 21 ++++++ layouts/partials/paginator.html | 52 +++++++++------ layouts/partials/post.html | 47 +++++++------ layouts/partials/posts.html | 144 ++++++++++++++++++++-------------------- theme.toml | 4 +- 15 files changed, 274 insertions(+), 200 deletions(-) create mode 100644 i18n/en.toml create mode 100644 i18n/zh-cn.toml create mode 100644 layouts/partials/navburger.html diff --git a/README.md b/README.md index 30a098f..91055d8 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,10 @@ ## Features -- basic functions: category/tag/archives +- small & fast +- basic functions: + - category & tag + - archives - TOC sidebar - `prefers-color-scheme` media support @@ -28,7 +31,7 @@ theme = "hulga" ``` and then config it. -3. to use `postcss`, copy `package.json ` and `postcss-config.js` to the root of your site folder, then `npm install` +3. to use `postcss`, copy `package.json ` and `postcss.config.js` to the root of your site folder, then `npm install` ## Config @@ -37,6 +40,7 @@ An example of avaliable params: ```toml baseURL = "https://example.com" languageCode = "zh-cn" +DefaultContentLanguage = "zh-cn" title = "My New Hugo Site" paginate = 10 theme = "hulga" @@ -66,6 +70,9 @@ theme = "hulga" # enable prefers-color-scheme:dark darkMedia = true + # enable hero section's is-bold effect + heroBold = true + # to enable different hightlight themes in light/dark mode [markup] [markup.highlight] diff --git a/assets/css/common.scss b/assets/css/common.scss index 26e4ec8..19b2665 100644 --- a/assets/css/common.scss +++ b/assets/css/common.scss @@ -120,10 +120,9 @@ a { } .post-box-tag { color: $primary; - font-size: 0.8em; + font-size: 0.9em; } .post-box-meta { - padding-top: 0.2rem; padding-bottom: 0.1rem; opacity: 0.8; font-size: 0.9rem; diff --git a/i18n/en.toml b/i18n/en.toml new file mode 100644 index 0000000..1fcae9e --- /dev/null +++ b/i18n/en.toml @@ -0,0 +1,23 @@ +[categories] +other = "Categories" + +[tags] +other = "Tags" + +[taxo_cat_before] +other = "Articles with category " + +[taxo_tag_before] +other = "Articles with tag " + +[taxo_after] +other = "" + +[prev_page] +other = "Previous" + +[next_page] +other = "Next" + +[archives] +other = "There are {{ .Count }} articles in this blog" \ No newline at end of file diff --git a/i18n/zh-cn.toml b/i18n/zh-cn.toml new file mode 100644 index 0000000..b7c786e --- /dev/null +++ b/i18n/zh-cn.toml @@ -0,0 +1,23 @@ +[categories] +other = "分类" + +[tags] +other = "标签" + +[taxo_cat_before] +other = "分类 " + +[taxo_tag_before] +other = "标签 " + +[taxo_after] +other = " 中的文章" + +[prev_page] +other = "上一页" + +[next_page] +other = "下一页" + +[archives] +other = "本博客共 {{ .Count }} 篇博文" \ No newline at end of file diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index fbf3fab..ea5525d 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -4,12 +4,11 @@
- {{- partial "nav.html" . -}} - {{- block "main" . }}{{- end }}
{{- partial "footer.html" . -}} {{- partial "backtotop.html" . -}} + {{- partial "navburger.html" . -}} {{- block "script" . }}{{- end }} diff --git a/layouts/_default/taxonomy.html b/layouts/_default/taxonomy.html index a528fe6..fba4a8f 100644 --- a/layouts/_default/taxonomy.html +++ b/layouts/_default/taxonomy.html @@ -3,33 +3,38 @@
-
- {{ if eq .Data.Singular "category" }} -

- 分类 - {{ .Data.Term }} - 中的文章 -

- {{ else if eq .Data.Singular "tag" }} -

- 包含标签 - {{ .Data.Term }} - 的文章 -

- {{ end }} -
-
- {{ $paginator := .Paginate (where .Data.Pages "Type" "post") }} - {{ range $paginator.Pages }} -
-
{{ .Date.Format "2006/01/02" }}
- +
+
+
+
+ {{ if eq .Data.Singular "category" }} +

+ {{- i18n "taxo_cat_before" -}} + {{ .Data.Term }} + {{- i18n "taxo_after" -}} +

+ {{ else if eq .Data.Singular "tag" }} +

+ {{- i18n "taxo_tag_before" -}} + {{ .Data.Term }} + {{- i18n "taxo_after" -}} +

+ {{ end }} +
+
+ {{ $paginator := .Paginate (where .Data.Pages "Type" "post") }} + {{ range $paginator.Pages }} +
+
{{ .Date.Format "2006/01/02" }}
+ +
+ {{ end }} + {{ partial "paginator.html" . }} +
- {{ end }} - {{ partial "paginator.html" . }} +
-
-{{ end }} +{{ end }} \ No newline at end of file diff --git a/layouts/archives/single.html b/layouts/archives/single.html index 18ce343..9cec5f7 100644 --- a/layouts/archives/single.html +++ b/layouts/archives/single.html @@ -4,7 +4,6 @@
- {{- partial "nav.html" . -}} {{- partial "header.html" . -}}
{{- block "archives-main" . }}{{- end }} @@ -19,22 +18,21 @@ {{ define "archives-main" }}
-
-
-

本博客共 {{len (where (where .Site.Pages "Type" "post") "Kind" "page")}} 篇博文

-
- {{ range (where (where .Site.Pages "Type" "post") "Kind" "page").GroupByDate "2006" }} -

{{ .Key }}

-
    - {{ range .Pages }} -
  • - {{ .Date.Format "2006/01/02" }} - {{ .Title }} -
  • - {{ end }} -
+
+ {{ $count := len (where (where .Site.Pages "Type" "post") "Kind" "page") }} +

{{ i18n "archives" (dict "Count" $count) }}

+
+ {{ range (where (where .Site.Pages "Type" "post") "Kind" "page").GroupByDate "2006" }} +

{{ .Key }}

+
    + {{ range .Pages }} +
  • + {{ .Date.Format "2006/01/02" }} + {{ .Title }} +
  • {{ end }} -
+ + {{ end }}
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index da744c0..b698406 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -2,7 +2,11 @@

Powered by Hugo. Theme Hulga

+ {{- if .Site.Params.copyright -}} {{ .Site.Params.copyright }} + {{- else -}} + {{ .Site.Copyright }} + {{ end }}

diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 2baa402..740eb25 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -1,4 +1,7 @@ -
+
+
+ {{ partial "nav.html" . }} +

diff --git a/layouts/partials/nav.html b/layouts/partials/nav.html index 350ce32..f2a8626 100644 --- a/layouts/partials/nav.html +++ b/layouts/partials/nav.html @@ -1,16 +1,16 @@ - +

+ \ No newline at end of file diff --git a/layouts/partials/navburger.html b/layouts/partials/navburger.html new file mode 100644 index 0000000..dc1e157 --- /dev/null +++ b/layouts/partials/navburger.html @@ -0,0 +1,21 @@ + diff --git a/layouts/partials/paginator.html b/layouts/partials/paginator.html index 95e9ee5..f311349 100644 --- a/layouts/partials/paginator.html +++ b/layouts/partials/paginator.html @@ -1,27 +1,35 @@ -{{ $paginator := .Paginate (where .Data.Pages "Type" "post") }} -{{ with $paginator }} - -{{ if gt .TotalPages 1 }} +{{ $pag := .Paginate (where .Data.Pages "Type" "post") }} +{{ if gt $pag.TotalPages 1 -}} -{{ end }} - + {{- else if $shouldEllipse }} +
  • + {{- end -}} + {{- end }} + + + {{ i18n "next_page"}} + {{ end }} diff --git a/layouts/partials/post.html b/layouts/partials/post.html index 554b9c7..80cf98d 100644 --- a/layouts/partials/post.html +++ b/layouts/partials/post.html @@ -1,6 +1,13 @@ -
    +
    +
    + {{ partial "nav.html" . }} +
    + {{ if or .Params.toc (and .Site.Params.toc (ne .Params.toc false)) }} +
    + {{ else }}
    + {{ end }}

    {{ .Title }}

    @@ -34,29 +41,25 @@
    {{ if or .Params.toc (and .Site.Params.toc (ne .Params.toc false)) }}
    - {{ else }} -
    -
    - {{ end }} -
    - {{- .Content -}} -
    -
    - {{ if or .Params.toc (and .Site.Params.toc (ne .Params.toc false)) }} -
    -
    diff --git a/layouts/partials/posts.html b/layouts/partials/posts.html index 50ea716..3c6512f 100644 --- a/layouts/partials/posts.html +++ b/layouts/partials/posts.html @@ -1,87 +1,89 @@ -
    +
    -
    -
    - {{ $paginator := .Paginate (where .Data.Pages "Type" "post") }} - {{ range $paginator.Pages }} -
    - {{ with .Params.Tags }} -
    - {{ range .}} - +
    +
    +
    +
    + {{ $paginator := .Paginate (where .Data.Pages "Type" "post") }} + {{ range $paginator.Pages }} +
    + {{ with .Params.Tags }} +
    + {{ range .}} + + {{ end }} +
    + {{ end }} +
    + {{ .Title }} +
    +
    + {{ .Date.Format "2006/01/02" }} + {{ with .Params.Categories }} ・ + {{ range .}} + + {{ end }} + {{ end }} +
    +
    {{ end }}
    - {{ end }} -
    - {{ .Title }} -
    -
    - {{ .Date.Format "2006/01/02" }} - {{ with .Params.Categories }} ・ - {{ range .}} - - {{ end }} - {{ end }} +
    + {{ partial "paginator.html" . }}
    - {{ end }} -
    -
    - {{ partial "paginator.html" . }} -
    -
    - -
    - {{ if .Site.Taxonomies.categories }} -
    -
    -

    - 分类 -

    -
    -
    -
    - {{ range $name, $taxonomy := .Site.Taxonomies.categories }} -
    - {{ $name }} - - {{ $taxonomy.Count }} - +
    + {{ if .Site.Taxonomies.categories }} +
    +
    +

    + {{ i18n "categories" }} +

    +
    +
    +
    + {{ range $name, $taxonomy := .Site.Taxonomies.categories }} +
    + {{ $name }} + + {{ $taxonomy.Count }} + +
    + {{ end }} +
    - {{ end }} -
    -
    -
    -
    - {{ end }} +
    + {{ end }} - {{ if .Site.Taxonomies.tags }} -
    -
    -

    - 标签 -

    -
    -
    -
    -
    - {{ range $name, $taxonomy := .Site.Taxonomies.tags }} - - {{ $name }} - - {{ end }} + {{ if .Site.Taxonomies.tags }} +
    +
    +

    + {{ i18n "tags" }} +

    +
    +
    +
    +
    + {{ range $name, $taxonomy := .Site.Taxonomies.tags }} + + {{ $name }} + + {{ end }} +
    +
    + {{ end }}
    - {{ end }}
    -
    +
    \ No newline at end of file diff --git a/theme.toml b/theme.toml index e0451db..75dc2a4 100644 --- a/theme.toml +++ b/theme.toml @@ -6,8 +6,8 @@ license = "MIT" licenselink = "https://github.com/wlh320/hugo-theme-hulga/blob/master/LICENSE" description = "hugo+bulma=hulga" homepage = "http://github.com/wlh320/hugo-theme-hulga/" -tags = ['bulma'] -features = [] +tags = ['bulma', 'blog', 'fast', 'simple', 'dark'] +features = ['bulma', 'fast', 'toc', 'dark mode'] min_version = "0.41.0" [author] -- cgit v1.2.3