diff options
-rw-r--r-- | LICENSE | 1 | ||||
-rw-r--r-- | LICENSE.md | 20 | ||||
-rw-r--r-- | assets/css/_common/_section/footer.scss | 4 | ||||
-rw-r--r-- | i18n/de.toml | 70 | ||||
-rw-r--r-- | i18n/en.toml | 99 | ||||
-rw-r--r-- | i18n/eo.toml | 70 | ||||
-rw-r--r-- | i18n/es.toml | 70 | ||||
-rw-r--r-- | i18n/fr.toml | 70 | ||||
-rw-r--r-- | i18n/it.toml | 71 | ||||
-rw-r--r-- | i18n/sq.toml | 71 | ||||
-rw-r--r-- | i18n/zh.toml | 71 | ||||
-rw-r--r-- | layouts/404.html | 4 | ||||
-rw-r--r-- | layouts/_default/baseof.html | 36 | ||||
-rw-r--r-- | layouts/_default/list.html | 18 | ||||
-rw-r--r-- | layouts/_default/single.html | 112 | ||||
-rw-r--r-- | layouts/_default/terms.html | 47 | ||||
-rw-r--r-- | layouts/page/single.html | 14 | ||||
-rw-r--r-- | layouts/partials/footer.html | 11 | ||||
-rw-r--r-- | layouts/partials/head.html | 87 | ||||
-rw-r--r-- | layouts/partials/header.html | 26 | ||||
-rw-r--r-- | layouts/partials/home_profile.html | 3 | ||||
-rw-r--r-- | layouts/partials/js.html | 6 | ||||
-rw-r--r-- | layouts/partials/paginator.html | 50 | ||||
-rw-r--r-- | layouts/posts/posts.html (renamed from layouts/_default/posts.html) | 10 | ||||
-rw-r--r-- | layouts/posts/single.html | 117 | ||||
-rw-r--r-- | layouts/sitemap.xml | 2 | ||||
-rw-r--r-- | layouts/taxonomy/list.html | 28 | ||||
-rw-r--r-- | layouts/taxonomy/terms.html | 61 |
28 files changed, 461 insertions, 788 deletions
@@ -1,6 +1,7 @@ The MIT License (MIT) Copyright (c) 2018 LIUZHICHAO.COM +Copyright (c) 2019 DILLONZQ.TOP Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in diff --git a/LICENSE.md b/LICENSE.md deleted file mode 100644 index a4d7087..0000000 --- a/LICENSE.md +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2018 LIUZHICHAO.COM - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/assets/css/_common/_section/footer.scss b/assets/css/_common/_section/footer.scss index 16b5e83..0328219 100644 --- a/assets/css/_common/_section/footer.scss +++ b/assets/css/_common/_section/footer.scss @@ -1,9 +1,9 @@ /**Footer**/ - + .copyright { font-size: 14px; } - + #dynamic-to-top { display: none; overflow: hidden; diff --git a/i18n/de.toml b/i18n/de.toml deleted file mode 100644 index 0aadc7a..0000000 --- a/i18n/de.toml +++ /dev/null @@ -1,70 +0,0 @@ -# Translations for German -# https://gohugo.io/content-management/multilingual/#translation-of-strings - -# Single.html - -[Written] -other = "Geschrieben" - -[by] -other = "durch" - -[with] -other = "mit" - -[on] -other = "auf" - -[in] -other = "im" - -[Author] -other = "Autor" - -[Words] -other = "Wörter" - -[Tag] -other = "Etikett" - -[Home] -other = "Hause" - -[back] -other = "Zurück" - -[minute] -other = "minute" - -[Share] -other = "Aktie" - -# 404.html - -[page] -other = "Seite" - -[not] -other = "nicht" - -[found] -other = "gefunden" - -[return] -other = "Zurückkommen" - -[to] -other = "zu" - -# Pagination - -[More] -other = "Mehr" - -# Related post - -[Related] -other = "Ähnliche" - -[Articles] -other = "Artikel"
\ No newline at end of file diff --git a/i18n/en.toml b/i18n/en.toml index 4aeb15a..d5ddc6f 100644 --- a/i18n/en.toml +++ b/i18n/en.toml @@ -1,70 +1,71 @@ # Translations for English # https://gohugo.io/content-management/multilingual/#translation-of-strings -# Single.html +# === Post === +[posts] +other = "Posts" +# === Post === -[Written] -other = "Written" - -[by] -other = "by" - -[with] -other = "with" - -[on] -other = "on" - -[in] -other = "in" - -[Author] -other = "Author" +# === Taxonomy === +[tag] +other = "Tag" -[Words] -other = "Words" +[tags] +other = "Tags" -[Tag] -other = "Tag" +[category] +other = "Category" -[Home] -other = "Home" +[categories] +other = "Categories" +# === Taxonomy === -[back] -other = "Back" +# === Pagination === +[More] +other = "More" +# === Pagination === -[minute] -other = "minute" +# === partials/footer.html === +[powered] +other = "Powered by %s" -[Share] -other = "Share" +[theme] +other = "Theme - " +# === partials/footer.html === -# 404.html +# === posts/single.html === +[wrote] +other = "wrote on" -[page] -other = "page" +[wordCount] +other = "about {{ .Count }} words" -[not] -other = "not" +[readingTime] +other = "{{ .Count }} min" -[found] -other = "found" +[author] +other = "Author" -[return] -other = "Return" +[lastMod] +other = "Last Modified" -[to] -other = "to" +[share] +other = "Share" -# Pagination +[license] +other = "License" -[More] -other = "More" +[back] +other = "Back" -# Related post +[home] +other = "Home" +# === posts/single.html === -[Related] -other = "Related" +# === 404.html === +[pageNotFound] +other = "Page not found" -[Articles] -other = "Articles"
\ No newline at end of file +[backToHome] +other = "Back to Home" +# === 404.html === diff --git a/i18n/eo.toml b/i18n/eo.toml deleted file mode 100644 index fd9f805..0000000 --- a/i18n/eo.toml +++ /dev/null @@ -1,70 +0,0 @@ -# Translations for Esperanto -# https://gohugo.io/content-management/multilingual/#translation-of-strings - -# Single.html - -[Written] -other = "Skribita" - -[by] -other = "de" - -[with] -other = "kun" - -[on] -other = "il" - -[in] -other = "sur" - -[Author] -other = "Aŭtoro" - -[Words] -other = "Vortoj" - -[Tag] -other = "Tag" - -[Home] -other = "Hejmo" - -[back] -other = "Reen" - -[minute] -other = "minuto" - -[Share] -other = "Kunhavigi" - -# 404.html - -[page] -other = "paĝo" - -[not] -other = "ne" - -[found] -other = "trovita" - -[return] -other = "Revenu" - -[to] -other = "al" - -# Pagination - -[More] -other = "Pli" - -# Related post - -[Related] -other = "Similaj" - -[Articles] -other = "Artikoloj"
\ No newline at end of file diff --git a/i18n/es.toml b/i18n/es.toml deleted file mode 100644 index 441cc8f..0000000 --- a/i18n/es.toml +++ /dev/null @@ -1,70 +0,0 @@ -# Translations for Spanish -# https://gohugo.io/content-management/multilingual/#translation-of-strings - -# Single.html - -[Written] -other = "Escrito" - -[by] -other = "por" - -[with] -other = "con" - -[on] -other = "en" - -[in] -other = "en" - -[Author] -other = "Autor" - -[Words] -other = "Palabras" - -[Tag] -other = "Etiqueta" - -[Home] -other = "Casa" - -[back] -other = "Atrás" - -[minute] -other = "minuto" - -[Share] -other = "Compartir" - -# 404.html - -[page] -other = "página" - -[not] -other = "no" - -[found] -other = "encontrada" - -[return] -other = "Volver" - -[to] -other = "a" - -# Pagination - -[More] -other = "Más" - -# Related post - -[Related] -other = "Artículos" - -[Articles] -other = "Similares"
\ No newline at end of file diff --git a/i18n/fr.toml b/i18n/fr.toml deleted file mode 100644 index 30e8659..0000000 --- a/i18n/fr.toml +++ /dev/null @@ -1,70 +0,0 @@ -# Translations for French -# https://gohugo.io/content-management/multilingual/#translation-of-strings - -# Single.html - -[Written] -other = "Écrit" - -[by] -other = "par" - -[with] -other = "avec" - -[on] -other = "sur" - -[in] -other = "dans" - -[Author] -other = "Auteur" - -[Words] -other = "Mots" - -[Tag] -other = "Étiquette" - -[Home] -other = "Accueil" - -[back] -other = "Retour" - -[minute] -other = "minute" - -[Share] -other = "Partager" - -# 404.html - -[page] -other = "Page" - -[not] -other = "non" - -[found] -other = "trouvée" - -[return] -other = "Retourner" - -[to] -other = "à" - -# Pagination - -[More] -other = "Plus" - -# Related post - -[Related] -other = "Articles" - -[Articles] -other = "Similaires"
\ No newline at end of file diff --git a/i18n/it.toml b/i18n/it.toml deleted file mode 100644 index 9fc1a02..0000000 --- a/i18n/it.toml +++ /dev/null @@ -1,71 +0,0 @@ -# Translations for Italian -# https://gohugo.io/content-management/multilingual/#translation-of-strings - -# Single.html - -[Written] -other = "Scritto" - -[by] -other = "da" - -[with] -other = "con" - -[on] -other = "il" - -[in] -other = "in" - -[Author] -other = "Autore" - -[Words] -other = "Parole" - -[Tag] -other = "Tag" - -[Home] -other = "Home" - -[back] -other = "Indietro" - -[minute] -other = "minuto" - -[Share] -other = "Condividi" - - -# 404.html - -[page] -other = "pagina" - -[not] -other = "non" - -[found] -other = "trovata" - -[return] -other = "Torna" - -[to] -other = "alla" - -# Pagination - -[More] -other = "Altro" - -# Related post - -[Related] -other = "Articoli" - -[Articles] -other = "Correlati"
\ No newline at end of file diff --git a/i18n/sq.toml b/i18n/sq.toml deleted file mode 100644 index 28c350e..0000000 --- a/i18n/sq.toml +++ /dev/null @@ -1,71 +0,0 @@ -# Translations for Albanian -# https://gohugo.io/content-management/multilingual/#translation-of-strings - -# Single.html - -[Written] -other = "Shkruar" - -[by] -other = "nga" - -[with] -other = "me" - -[on] -other = "në" - -[in] -other = "në" - -[Author] -other = "Autor" - -[Words] -other = "Fjalë" - -[Tag] -other = "Etiketë" - -[Home] -other = "Shtëpi" - -[back] -other = "Prapa" - -[minute] -other = "minutë" - -[Share] -other = "Pjesë" - - -# 404.html - -[page] -other = "Faqja" - -[not] -other = "nuk u" - -[found] -other = "gjet" - -[return] -other = "Kthehu" - -[to] -other = "në" - -# Pagination - -[More] -other = "më shumë" - -# Related post - -[Related] -other = "Artikuj" - -[Articles] -other = "Të lidhura"
\ No newline at end of file diff --git a/i18n/zh.toml b/i18n/zh.toml new file mode 100644 index 0000000..739970e --- /dev/null +++ b/i18n/zh.toml @@ -0,0 +1,71 @@ +# Translations for Simplified Chinese +# https://gohugo.io/content-management/multilingual/#translation-of-strings + +# === Post === +[posts] +other = "文章" +# === Post === + +# === Taxonomy === +[tag] +other = "标签" + +[tags] +other = "标签" + +[category] +other = "分类" + +[categories] +other = "分类" +# === Taxonomy === + +# === Pagination === +[More] +other = "更多" +# === Pagination === + +# === partials/footer.html === +[powered] +other = "由 %s 强力驱动" + +[theme] +other = "主题 - " +# === partials/footer.html === + +# === posts/single.html === +[wrote] +other = "创作于" + +[wordCount] +other = "约 {{ .Count }} 字" + +[readingTime] +other = "预计阅读 {{ .Count }} 分钟" + +[author] +other = "作者" + +[lastMod] +other = "上次更新" + +[share] +other = "内容分享" + +[license] +other = "许可协议" + +[back] +other = "返回" + +[home] +other = "主页" +# === posts/single.html === + +# === 404.html === +[pageNotFound] +other = "页面没找到" + +[backToHome] +other = "回到主页" +# === 404.html === diff --git a/layouts/404.html b/layouts/404.html index da1ae41..7efa393 100644 --- a/layouts/404.html +++ b/layouts/404.html @@ -1,8 +1,8 @@ {{ define "content" }} <div class="notfound"> <h1 class="error-emoji"></h1> - <p class="error-text">/* 404 {{ i18n "page" }} {{ i18n "not" }} {{ i18n "found" }}. */</p> - <p class="error-link"><a href="{{ .Site.BaseURL }}">↑ {{ i18n "back" }} {{ i18n "to" }} {{ i18n "Home" }} ↑</a></p> + <p class="error-text">/* 404 {{ T "pageNotFound" }}. */</p> + <p class="error-link"><a href="{{ .Site.BaseURL }}">↑ {{ T "backToHome" }} ↑</a></p> </div> <script> var errorEmojiContainer = document.getElementsByClassName('error-emoji')[0]; diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 3102f82..9925b60 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -1,15 +1,27 @@ <!DOCTYPE html> <html lang="{{ .Site.LanguageCode }}"> - {{ partial "head.html" . }} - <body class=""> - <div class="wrapper"> - {{ partial "header" . }} - <main class="main"> - <div class="container"> - {{ block "content" . }}{{ end }} - </div> - </main> - {{ partial "footer.html" . }} - </div> - </body> + <head> + <meta charset="utf-8"> + <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> + <title>{{ block "title" . -}}{{ .Site.Title }}{{- end }}</title> + {{ partial "head.html" . }} + </head> + {{ $cdn_url := ""}} + {{ if eq ( getenv "HUGO_ENV" ) "production" }} + {{ with .Site.Params.cdn_url }} + {{ $cdn_url = .}} + {{ end }} + {{ end }} + {{ .Scratch.Set "cdn_url" $cdn_url }} + <body class=""> + <div class="wrapper"> + {{ partial "header" . }} + <main class="main"> + <div class="container"> + {{ block "content" . }}{{ end }} + </div> + </main> + {{ partial "footer.html" . }} + </div> + </body> </html> diff --git a/layouts/_default/list.html b/layouts/_default/list.html deleted file mode 100644 index b4c6724..0000000 --- a/layouts/_default/list.html +++ /dev/null @@ -1,18 +0,0 @@ -{{ define "content" }} -{{ $data := .Data }} -<div class="post-warp archive"> - <h2 class="post-title" style="text-align:right;padding-bottom:2em">- {{ $data.Plural | humanize }}{{ .Title }} -</h2> - {{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }} - <h3>{{ .Key }}</h3> - - {{ range .Pages }} - <article class="archive-item"> - <a href="{{ .RelPermalink }}" class="archive-item-link">{{ .Title }}</a> - <span class="archive-item-date"> - {{ .Date.Format "2 January 2006" }} - </span> - </article> - {{ end }} {{ end }} - {{ partial "paginator.html" . }} -</div> -{{end }}
\ No newline at end of file diff --git a/layouts/_default/single.html b/layouts/_default/single.html deleted file mode 100644 index d9bd592..0000000 --- a/layouts/_default/single.html +++ /dev/null @@ -1,112 +0,0 @@ -{{ define "content" -}} -{{ $cdn_url := .Scratch.Get "cdn_url" }} -<article class="post-warp"> - <header class="post-header"> - <h1 class="post-title">{{ .Title }}</h1> - <div class="post-meta"> - {{ i18n "Written" }} {{ i18n "by" }} <a href="{{.Site.BaseURL }}" rel="author">{{ if isset .Params "author" }}{{ .Params.author }}{{ else }}{{ .Site.Params.author }}{{ end }}</a> {{ i18n "with" }} ♥ - <span class="post-time"> - {{ i18n "on" }} <time datetime={{.Date.Format (.Site.Params.dateFormatToUse | default "2006-01-02") }} >{{ .Date.Format (.Site.Params.dateFormatToUse | default "2 January 2006") }}</time> - </span> - {{ i18n "in" }} - {{ with .Params.categories -}} - <i class="iconfont icon-folder"></i> - <span class="post-category"> - {{ range . }} - {{- $name := . -}} - {{- with $.Site.GetPage "taxonomy" (printf "categories/%s" $name) | default ($.Site.GetPage "taxonomy" (printf "categories/%s" ($name | urlize))) -}} - <a href="{{ .Permalink }}"> {{ $name }} </a> - {{ end -}} - {{ end }} - </span> - {{- end }} - <i class="iconfont icon-timer"></i> - {{.ReadingTime }} min - </div> - </header> - <div class="post-content"> - <!--featured_image--> - - {{ $images := findRE "<img src=\"[^\"|\\\"]*\"" .Content -}} - {{ if ge (len $images) 1}} - {{ $.Scratch.Set "postHasImages" true }} - {{ end }} - - {{ with .Params.featured_image }} - {{- $img := . -}} - <img src="{{ printf "%s%s" $cdn_url $img }}" class="featured_image"> - {{ end }} - <!-- end featured_image--> - - {{ $reAltIn := "<img src=\"([^\"]+)\" alt=\"([^\"]+)?\" />" }} - {{ $reAltOut := ( printf "<figure><img src=\"/images/ring.svg\" data-sizes=\"auto\" data-src=\"%s$1\" alt=\"$2\" class=\"lazyload\"><figcaption class=\"image-caption\">$2</figcaption></figure>" $cdn_url ) }} - {{ $altContent := .Content | replaceRE $reAltIn $reAltOut | safeHTML }} - - {{ $reAltTitleIn := "<img src=\"([^\"]+)\" alt=\"([^\"]+)?\" title=\"([^\"]+)?\" />" }} - {{ $reAltTitleOut := ( printf "<figure><img src=\"/images/ring.svg\" data-src=\"%s$1\" data-sizes=\"auto\" alt=\"$2\" title=\"$3\" class=\"lazyload\"><figcaption class=\"image-caption\">$2</figcaption></figure>" $cdn_url ) }} - {{ $finalContent := $altContent | replaceRE $reAltTitleIn $reAltTitleOut | safeHTML }} - - {{ $finalContent }} - </div> - - <div class="post-copyright"> - {{ with .Site.Params.author }} - <p class="copyright-item"> - <span>{{ i18n "Author" }}:</span> - <span>{{ . }} </span> - </p> - {{ end }} - - <p class="copyright-item"> - <span>{{ i18n "Words" }}:</span> - <span>{{ .WordCount }}</span> - </p> - - <p class="copyright-item"> - {{ if and ( $.Param "socialShare" ) (gt (len ($.Param "share")) 0) }} - <span>{{ i18n "Share" }}:</span> - <span>{{ partial "share-links" . }}</span> - {{ end }} - </p> - - {{ with .Site.Params.license }} - <p class="copyright-item"> - {{ . | safeHTML}} - </p> - {{ end }} - </div> - - <div class="post-tags"> - {{ with .Params.tags }} - <section> - <i class="iconfont icon-icon-tag"></i>{{ i18n "Tag" }}: - {{ range . }} - <span class="tag"> - <a href="{{ "tags/" | absURL }}{{ . | urlize }}/">#{{.}}</a> - </span> - {{ end }} - </section> - {{ end }} - <section> - <a href="javascript:window.history.back();">{{ i18n "back" }}</a></span> · - <span><a href="{{ .Site.BaseURL }}">{{ i18n "Home" }}</a></span> - </section> - </div> - - <div class="post-nav"> - {{ if .PrevInSection }} - <a href="{{.PrevInSection.Permalink}}" class="prev" rel="prev" title="{{ .PrevInSection.Title}}"><i class="iconfont icon-dajiantou"></i> {{ .PrevInSection.Title}}</a> - {{ end }} - {{ if .NextInSection }} - <a href="{{.NextInSection.Permalink}}" class="next" rel="next" title="{{.NextInSection.Title}}">{{.NextInSection.Title}} <i class="iconfont icon-xiaojiantou"></i></a> - {{ end }} - </div> - - <div class="post-comment"> - {{ if ( .Params.showComments | default true ) }} - {{ partial "comments" . }} - {{ end }} - </div> -</article> -{{- end }} - diff --git a/layouts/_default/terms.html b/layouts/_default/terms.html deleted file mode 100644 index 8261c5c..0000000 --- a/layouts/_default/terms.html +++ /dev/null @@ -1,47 +0,0 @@ -{{ define "content" }} - -{{ $termName := .Data.Plural }} -{{ $terms := .Data.Terms.ByCount }} -{{ $length := len $terms }} -{{ $type := .Type }} -<!-- Categories Page --> -<div class="post-warp {{.Data.Plural}}"> - <h2 class="post-title" style="text-align:right;padding-bottom:2em">- {{ .Data.Plural | humanize }} -</h2> -{{ if and $.Site.Taxonomies.categories (eq $termName "categories") }} - -<div class="categories-card"> -{{ range $terms }} - {{ $term := .Term }} - {{ $pages := .Pages }} - {{ with $.Site.GetPage "taxonomy" (printf "%s/%s" $type $term) }} - <div class="card-item"> - <div class="categories" > - <a href="{{ .Permalink }}"><h3> <i class="iconfont icon-folder" style="padding-right: 3px"></i> {{ $term | humanize}} </h3> </a> - {{ range first 5 $pages }} - <article class="archive-item"> - <a href="{{ .Permalink }}" class="archive-item-link">{{ .Title }}</a> - </article> - {{ end }} - {{ if gt (len $pages) 5 }} - <span class="more-post"> - <a href="{{ .Permalink }}" class="more-post-link">{{ i18n "More" }} >></a> - </span> - {{ end }} - </div> - </div> - {{ end }} -{{ end }} -</div> <!-- //categories-card --> - <!-- Tag cloud Page --> -{{ else if and $.Site.Taxonomies.tags (eq $termName "tags") }} - <div class="tag-cloud-tags"> - {{ range $.Site.Taxonomies.tags.ByCount }} - {{ if .Name }} - <a href="/tags/{{ .Name | urlize}}/"> {{ .Name }} <small>({{ .Count }})</small></a> - {{ end }} - {{end}} - </div> - -{{ end }} -</div> -{{end }} diff --git a/layouts/page/single.html b/layouts/page/single.html index c3044db..47a1eeb 100644 --- a/layouts/page/single.html +++ b/layouts/page/single.html @@ -1,8 +1,10 @@ +{{ define "title" }}{{ .Title }} - {{ .Site.Title }}{{ end }} + {{ define "content" }} -<div class="post-warp archive"> - <h2 class="post-title" style="text-align:right;padding-bottom:2em">{{ .Title }}</h2> - <div class="post-content"> - {{ .Content }} + <div class="post-warp archive"> + <h2 class="post-title" style="text-align:right;padding-bottom:2em">{{ .Title }}</h2> + <div class="post-content"> + {{ .Content }} + </div> </div> -</div> -{{end }}
\ No newline at end of file +{{end }} diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 255f7af..5194f3c 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -2,13 +2,14 @@ <div class="copyright"> © {{ with .Site.Params.since }} - <span itemprop="copyrightYear">{{.}} - {{ now.Year }}</span> + <span itemprop="copyrightYear">{{ if lt . now.Year }}{{ . }} - {{ end }}{{ now.Year }}</span> + {{ end }} + {{ if .Site.Params.author }} + <span class="author" itemprop="copyrightHolder"><a href="{{ .Site.BaseURL }}">{{ .Site.Params.author }}</a> | + </span> {{ end }} - {{ if .Site.Params.author }} - <span class="author" itemprop="copyrightHolder"><a href="{{ .Site.BaseURL }}">{{ .Site.Params.author }}</a> | </span> - {{ end }} - <span>Crafted with ❤️ by <a href="https://github.com/Fastbyte01/KeepIt" target="_blank" rel="external nofollow noopener noreffer">KeepIt</a> & <a href="https://gohugo.io/" target="_blank" rel="external nofollow noopener noreffer">Hugo</a></span> + <span>{{ (printf (T "powered") `<a href="https://gohugo.io/" target="_blank" rel="external nofollow noopener noreffer">Hugo</a>`) | safeHTML }} | {{ T "theme" }}<a href="https://github.com/dillonzq/KeepIt" target="_blank" rel="external nofollow noopener noreffer">KeepIt</a></span> </div> </footer> diff --git a/layouts/partials/head.html b/layouts/partials/head.html index bfaaa2f..36cfac6 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -1,48 +1,39 @@ -<head> - <meta http-equiv="content-type" content="text/html;charset=utf-8"> - <meta http-equiv="X-UA-Compatible" content="chrome=1"> - <meta name="viewport" content="width=device-width, initial-scale=1.0"> - <meta name="robots" content="noodp"/> - {{ with .Site.Params.google_verification }}<meta name="google-site-verification" content="{{ . }}" />{{ end }} - {{ with .Site.Params.bing_verification }}<meta name="msvalidate.01" content="{{ . }}" />{{end}} - {{ with .Site.Params.yandex_verification }}<meta name="yandex-verification" content="{{ . }}" />{{ end }} - {{ with .Site.Params.pinterest_verification }}<meta name="p:domain_verify" content="{{ . }}"/>{{ end }} - {{ with .Site.Params.baidu_verification }}<meta name=”baidu-site-verification” content="{{ . }}" />{{ end }} - {{ if .PrevInSection }}<link rel="prev" href="{{.PrevInSection.Permalink}}" />{{end}} - {{ if .NextInSection}}<link rel="next" href="{{ .NextInSection.Permalink }}" />{{end}} - <link rel="canonical" href="{{ .Permalink }}" /> - <link rel='shortcut icon' type='image/x-icon' href='/favicon.ico' /> - <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"> - <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"> - <link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"> - <link rel="manifest" href="/site.webmanifest"> - <link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5"> - <meta name="msapplication-TileColor" content="#da532c"> - <meta name="theme-color" content="#ffffff"> - <title> - {{ $url := replace .Permalink ( printf "%s" .Site.BaseURL) "" }} - {{ if .IsHome }} - {{ .Site.Title }} - {{ else if .Params.heading }} - {{ .Params.heading }} - {{ else }} - {{ .Title }} | {{ .Site.Title }} - {{ end }} - </title> - <meta name="title" content="{{ if .IsHome }}{{ .Site.Title }}{{ else if .Params.heading }}{{ .Params.heading }}{{ else }}{{ .Title }} | {{ .Site.Title }}{{ end}}"> - {{ partial "css" . }} - {{ with .OutputFormats.Get "RSS" }} - <link rel="alternate" href="{{ .RelPermalink }}" type="application/rss+xml" title="{{ site.Title }}"> - <link rel="feed" href="{{ .RelPermalink }}" type="application/rss+xml" title="{{ site.Title }}"> - {{ end }} - {{- template "_internal/twitter_cards.html" . }} - {{ partial "seo_schema" . }} -</head> -{{ $cdn_url := ""}} - {{ if eq ( getenv "HUGO_ENV" ) "production" }} - {{ with .Site.Params.cdn_url }} - {{ $cdn_url = .}} - {{ end }} - {{ end }} -{{ .Scratch.Set "cdn_url" $cdn_url }} - +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta name="robots" content="noodp" /> +{{ with .Site.Params.google_verification }} + <meta name="google-site-verification" content="{{ . }}" /> +{{ end }} +{{ with .Site.Params.bing_verification }} + <meta name="msvalidate.01" content="{{ . }}" /> +{{end}} +{{ with .Site.Params.yandex_verification }} + <meta name="yandex-verification" content="{{ . }}" /> +{{ end }} +{{ with .Site.Params.pinterest_verification }} + <meta name="p:domain_verify" content="{{ . }}" /> +{{ end }} +{{ with .Site.Params.baidu_verification }} + <meta name=”baidu-site-verification” content="{{ . }}" /> +{{ end }} +{{ if .PrevInSection }} + <link rel="prev" href="{{.PrevInSection.Permalink}}" /> +{{ end }} +{{ if .NextInSection}} + <link rel="next" href="{{ .NextInSection.Permalink }}" /> +{{end}} +<link rel="canonical" href="{{ .Permalink }}" /> +<link rel='shortcut icon' type='image/x-icon' href='/favicon.ico' /> +<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"> +<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"> +<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"> +<link rel="manifest" href="/site.webmanifest"> +<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5"> +<meta name="msapplication-TileColor" content="#da532c"> +<meta name="theme-color" content="#ffffff"> +{{ partial "css" . }} +{{ with .OutputFormats.Get "RSS" }} + <link rel="alternate" href="{{ .RelPermalink }}" type="application/rss+xml" title="{{ site.Title }}"> + <link rel="feed" href="{{ .RelPermalink }}" type="application/rss+xml" title="{{ site.Title }}"> +{{ end }} +{{ template "_internal/twitter_cards.html" . }} +{{ partial "seo_schema" . }} diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 875bcde..cc4d8c1 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -1,17 +1,19 @@ <nav class="navbar"> <div class="container"> <div class="navbar-header header-logo"> - <a href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a> + <a href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a> </div> + <div class="menu navbar-right"> - {{ $currentPage := . }} - {{ range .Site.Menus.main }} - <a class="menu-item{{if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) }} active{{end}}" href="{{ .URL }}" title="{{ .Title }}">{{ .Name }}</a> - {{ end }} - <a href="javascript:void(0);" class="theme-switch"><i class="iconfont icon-sun"></i></a> + {{ $currentPage := . }} + {{ range .Site.Menus.main }} + <a class="menu-item{{ if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) }} active{{ end }}" href="{{ .URL | absLangURL }}" title="{{ .Title }}">{{ .Name }}</a> + {{ end }} + <a href="javascript:void(0);" class="theme-switch"><i class="iconfont icon-sun"></i></a> </div> </div> </nav> + <nav class="navbar-mobile" id="nav-mobile" style="display: none"> <div class="container"> <div class="navbar-header"> @@ -20,12 +22,12 @@ <span></span><span></span><span></span> </div> </div> - - <div class="menu" id="mobile-menu"> - {{ $currentPage := . }} - {{ range .Site.Menus.main }} - <a class="menu-item{{if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) }} active{{end}}" href="{{ .URL }}" title="{{ .Title }}">{{ .Name }}</a> - {{ end }} + + <div class="menu" id="mobile-menu"> + {{ $currentPage := . }} + {{ range .Site.Menus.main }} + <a class="menu-item{{if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) }} active{{ end }}" href="{{ .URL | absLangURL }}" title="{{ .Title }}">{{ .Name }}</a> + {{ end }} </div> </div> </nav> diff --git a/layouts/partials/home_profile.html b/layouts/partials/home_profile.html index d50ece1..50a3e0a 100644 --- a/layouts/partials/home_profile.html +++ b/layouts/partials/home_profile.html @@ -18,6 +18,5 @@ {{ end }} <div class="social-links"> {{ partial "social.html" . }} - </div> -</div>
\ No newline at end of file +</div> diff --git a/layouts/partials/js.html b/layouts/partials/js.html index 9ccadd1..0db6572 100644 --- a/layouts/partials/js.html +++ b/layouts/partials/js.html @@ -10,14 +10,14 @@ {{ if .IsPage }} {{ if $postHasImages }} - <link href="//lib.baomitu.com/lightgallery/1.6.12/css/lightgallery.min.css" rel="stylesheet"> - {{ $vendorscript := slice $jquery $lazysizes $prettify $dynamic $main $lihtGallery $lihtGallery_init | resources.Concat "/js/vendor_gallery.js" | resources.Minify }} + <link crossorigin="anonymous" integrity="sha384-yziQACfvCVwLqVFLqkWBYRO3XeA4EqzfXKGwaWnenYn5XzqfJFlFdKEmvutIQdKb" href="https://lib.baomitu.com/lightgallery/1.6.12/css/lightgallery.min.css" rel="stylesheet"> + {{ $vendorscript := slice $jquery $lazysizes $prettify $dynamic $main $lihtGallery $lihtGallery_init | resources.Concat "/js/vendor_gallery.js" | resources.Minify }} <script src="{{ printf "%s%s" $cdn_url $vendorscript.RelPermalink }}" async="" ></script> {{ else }} {{ $vendorscript := slice $jquery $prettify $dynamic $main | resources.Concat "/js/vendor_no_gallery.js" | resources.Minify }} <script src="{{ printf "%s%s" $cdn_url $vendorscript.RelPermalink }}" async=""></script> {{ end }} - + {{ else }} {{ $main := slice $jquery $main | resources.Concat "/js/vendor_main.js" | resources.Minify}} <script src="{{ printf "%s%s" $cdn_url $main.RelPermalink }}" async=""></script> diff --git a/layouts/partials/paginator.html b/layouts/partials/paginator.html index 4451b99..6ad5f30 100644 --- a/layouts/partials/paginator.html +++ b/layouts/partials/paginator.html @@ -1,29 +1,31 @@ {{ $pag := $.Paginator }} + {{ if gt $pag.TotalPages 1 }} -<ul class="pagination"> - {{ with $pag.First }} - {{ end }} + <ul class="pagination"> + {{ with $pag.First }} + {{ end }} - {{ $.Scratch.Set "__paginator.ellipsed" false }} - {{ range $pag.Pagers }} - {{ $right := sub .TotalPages .PageNumber }} - {{ $showNumber := or (le .PageNumber 1) (eq $right 0) }} - {{ $showNumber := or $showNumber (and (gt .PageNumber (sub $pag.PageNumber 3)) (lt .PageNumber (add $pag.PageNumber 3))) }} - {{ if $showNumber }} {{ $.Scratch.Set "__paginator.ellipsed" false }} - {{ $.Scratch.Set "__paginator.shouldEllipse" false }} - {{ else }} - {{ $.Scratch.Set "__paginator.shouldEllipse" (not ($.Scratch.Get "__paginator.ellipsed") ) }} - {{ $.Scratch.Set "__paginator.ellipsed" true }} - {{ end }} - {{ if $showNumber }} - <li class="page-item {{ if eq . $pag }}active{{ end }}"> - <span class="page-link"> - <a href="{{ .URL }}">{{ .PageNumber }}</a></li> - </span> - {{ else if ($.Scratch.Get "__paginator.shouldEllipse") }} - <li class="page-item "><span class="page-link" aria-hidden="true">…</span></li> - {{ end }} - {{ end }} -</ul> + {{ range $pag.Pagers }} + {{ $right := sub .TotalPages .PageNumber }} + {{ $showNumber := or (le .PageNumber 1) (eq $right 0) }} + {{ $showNumber := or $showNumber (and (gt .PageNumber (sub $pag.PageNumber 3)) (lt .PageNumber (add $pag.PageNumber 3))) }} + {{ if $showNumber }} + {{ $.Scratch.Set "__paginator.ellipsed" false }} + {{ $.Scratch.Set "__paginator.shouldEllipse" false }} + {{ else }} + {{ $.Scratch.Set "__paginator.shouldEllipse" (not ($.Scratch.Get "__paginator.ellipsed") ) }} + {{ $.Scratch.Set "__paginator.ellipsed" true }} + {{ end }} + {{ if $showNumber }} + <li class="page-item {{ if eq . $pag }}active{{ end }}"> + <span class="page-link"> + <a href="{{ .URL }}">{{ .PageNumber }}</a> + </span> + </li> + {{ else if ($.Scratch.Get "__paginator.shouldEllipse") }} + <li class="page-item "><span class="page-link" aria-hidden="true">…</span></li> + {{ end }} + {{ end }} + </ul> {{ end }} diff --git a/layouts/_default/posts.html b/layouts/posts/posts.html index b4c6724..236952f 100644 --- a/layouts/_default/posts.html +++ b/layouts/posts/posts.html @@ -1,7 +1,11 @@ +{{ define "title" }}{{ T "posts" }} - {{ .Site.Title }}{{ end }} + {{ define "content" }} {{ $data := .Data }} <div class="post-warp archive"> - <h2 class="post-title" style="text-align:right;padding-bottom:2em">- {{ $data.Plural | humanize }}{{ .Title }} -</h2> + <h2 class="post-title" style="text-align:right;padding-bottom:2em"> + {{- printf "- %s -" (T "posts") -}} + </h2> {{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }} <h3>{{ .Key }}</h3> @@ -9,10 +13,10 @@ <article class="archive-item"> <a href="{{ .RelPermalink }}" class="archive-item-link">{{ .Title }}</a> <span class="archive-item-date"> - {{ .Date.Format "2 January 2006" }} + {{ .Date.Format (.Site.Params.dateFormatToUse | default "01-02") }} </span> </article> {{ end }} {{ end }} {{ partial "paginator.html" . }} </div> -{{end }}
\ No newline at end of file +{{end }} diff --git a/layouts/posts/single.html b/layouts/posts/single.html new file mode 100644 index 0000000..3ac8ba3 --- /dev/null +++ b/layouts/posts/single.html @@ -0,0 +1,117 @@ +{{ define "title" }}{{ .Title }} - {{ .Site.Title }}{{ end }} + +{{ define "content" }} + {{ $cdn_url := .Scratch.Get "cdn_url" }} + {{ $publish_date := .PublishDate.Format (.Site.Params.dateFormatToUse | default "2006-01-02") }} + {{ $modify_date := .Lastmod.Format (.Site.Params.dateFormatToUse | default "2006-01-02") }} + {{ $author := .Site.Params.author }} + {{ if isset .Params "author" }} + {{ $author = .Params.author }} + {{ end }} + + <article class="post-warp"> + <header class="post-header"> + <h1 class="post-title">{{ .Title }}</h1> + <div class="post-meta"> + <a href="{{.Site.BaseURL }}" rel="author">{{ $author }}</a> + {{ T "wrote" }} + <span class="post-time"><time datetime={{ $publish_date }}>{{ $publish_date }}</time></span> + ✎ + {{ T "wordCount" .WordCount }} + <i class="iconfont icon-timer"></i> + {{ T "readingTime" .ReadingTime }} + + {{ with .Params.categories -}} + <span class="post-category"> + {{ range . }} + {{- $name := . -}} + {{- with $.Site.GetPage "taxonomy" (printf "categories/%s" $name) | default ($.Site.GetPage "taxonomy" (printf "categories/%s" ($name | urlize))) -}} + <i class="iconfont icon-folder"></i> + <a href="{{ .Permalink }}">{{ $name }}</a> + {{ end -}} + {{ end }} + </span> + {{- end }} + </div> + </header> + <div class="post-content"> + <!--featured_image--> + {{ $images := findRE "<img src=\"[^\"|\\\"]*\"" .Content -}} + {{ if ge (len $images) 1}} + {{ $.Scratch.Set "postHasImages" true }} + {{ end }} + {{ with .Params.featured_image }} + {{ $img := . }}<img src="{{ printf "%s%s" $cdn_url $img }}" class="featured_image"> + {{ end }} + <!-- end featured_image--> + + {{ $reAltIn := "<img src=\"([^\"]+)\" alt=\"([^\"]+)?\" />" }} + {{ $reAltOut := ( printf "<figure><img src=\"/images/ring.svg\" data-sizes=\"auto\" data-src=\"%s$1\" alt=\"$2\" class=\"lazyload\"><figcaption class=\"image-caption\">$2</figcaption></figure>" $cdn_url ) }} + {{ $altContent := .Content | replaceRE $reAltIn $reAltOut | safeHTML }} + {{ $reAltTitleIn := "<img src=\"([^\"]+)\" alt=\"([^\"]+)?\" title=\"([^\"]+)?\" />" }} + {{ $reAltTitleOut := ( printf "<figure><img src=\"/images/ring.svg\" data-src=\"%s$1\" data-sizes=\"auto\" alt=\"$2\" title=\"$3\" class=\"lazyload\"><figcaption class=\"image-caption\">$2</figcaption></figure>" $cdn_url ) }} + {{ $finalContent := $altContent | replaceRE $reAltTitleIn $reAltTitleOut | safeHTML }} + {{ $finalContent }} + </div> + + <div class="post-copyright"> + <p class="copyright-item"> + <span>{{ T "author" }}:</span> + <span><a href="{{.Site.BaseURL }}" rel="author">{{ $author }}</a></span> + </p> + + <p class="copyright-item"> + <span>{{ T "lastMod" }}:</span> + <span>{{ $modify_date }}</span> + </p> + + <p class="copyright-item"> + {{ if and ( $.Param "socialShare" ) (gt (len ($.Param "share")) 0) }} + <span>{{ T "share" }}:</span> + <span>{{ partial "share-links" . }}</span> + {{ end }} + </p> + + {{ with .Site.Params.license }} + <p class="copyright-item"> + <span>{{ T "license" }}:</span> + <span>{{ . | safeHTML }}</span> + </p> + {{ end }} + </div> + + <div class="post-tags"> + {{ with .Params.tags }} + <section> + <i class="iconfont icon-icon-tag"></i>{{ T "tag" }}: + {{ range . }} + <span class="tag"> + <a href="{{ "tags/" | absURL }}{{ . | urlize }}/">#{{.}}</a> + </span> + {{ end }} + </section> + {{ end }} + <section> + <a href="javascript:window.history.back();">{{ T "back" }}</a></span> · + <span><a href="{{ .Site.BaseURL }}">{{ T "home" }}</a></span> + </section> + </div> + + <div class="post-nav"> + {{ if .PrevInSection }} + <a href="{{.PrevInSection.Permalink}}" class="prev" rel="prev" title="{{ .PrevInSection.Title}}"><i + class="iconfont icon-dajiantou"></i> {{ .PrevInSection.Title}}</a> + {{ end }} + {{ if .NextInSection }} + <a href="{{.NextInSection.Permalink}}" class="next" rel="next" + title="{{.NextInSection.Title}}">{{.NextInSection.Title}} <i class="iconfont icon-xiaojiantou"></i></a> + {{ end }} + </div> + + <div class="post-comment"> + {{ if ( .Params.showComments | default true ) }} + {{ partial "comments" . }} + {{ end }} + </div> + </article> +{{- end }} diff --git a/layouts/sitemap.xml b/layouts/sitemap.xml index 20c6f28..15bffee 100644 --- a/layouts/sitemap.xml +++ b/layouts/sitemap.xml @@ -3,7 +3,7 @@ <url> <loc>{{ .Permalink }}</loc> {{ if not .Lastmod.IsZero }} - <lastmod>{{ safeHTML ( .Lastmod.Format"2006-01-02T15:04:05-07:00" ) }}</lastmod> + <lastmod>{{ safeHTML ( .Lastmod.Format "2006-01-02T15:04:05-07:00" ) }}</lastmod> {{ end }} {{ with .Sitemap.ChangeFreq }} <changefreq>{{ . }}</changefreq> diff --git a/layouts/taxonomy/list.html b/layouts/taxonomy/list.html new file mode 100644 index 0000000..6449d40 --- /dev/null +++ b/layouts/taxonomy/list.html @@ -0,0 +1,28 @@ +{{ define "title" }}{{ .Title }} - {{ .Site.Title }}{{ end }} + +{{ define "content" }} + {{ $taxonomy := .Data.Singular }} + {{ $taxonomyName := $taxonomy }} + {{ if eq $taxonomy "tag"}} + {{ $taxonomyName = (T "tag") }} + {{ else if eq $taxonomy "category"}} + {{ $taxonomyName = (T "category") }} + {{ end }} + <div class="post-warp archive"> + <h2 class="post-title" style="text-align:right;padding-bottom:2em"> + {{- printf "%s - %s" $taxonomyName .Title -}} + </h2> + {{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }} + <h3>{{ .Key }}</h3> + {{ range .Pages }} + <article class="archive-item"> + <a href="{{ .RelPermalink }}" class="archive-item-link">{{ .Title }}</a> + <span class="archive-item-date"> + {{ .Date.Format (.Site.Params.dateFormatToUse | default "01-02") }} + </span> + </article> + {{ end }} + {{ end }} + {{ partial "paginator.html" . }} + </div> +{{end }} diff --git a/layouts/taxonomy/terms.html b/layouts/taxonomy/terms.html new file mode 100644 index 0000000..3bed3fc --- /dev/null +++ b/layouts/taxonomy/terms.html @@ -0,0 +1,61 @@ +{{ define "title" }}{{ .Title }} - {{ .Site.Title }}{{ end }} + +{{ define "content" }} + {{ $taxonomy := .Data.Singular }} + {{ $taxonomysName := $taxonomy }} + {{ if eq $taxonomy "tag"}} + {{ $taxonomysName = (T "tags") }} + {{ else if eq $taxonomy "category"}} + {{ $taxonomysName = (T "categories") }} + {{ end }} + + {{ $terms := .Data.Terms.ByCount }} + {{ $length := len $terms }} + {{ $type := .Type }} + + <div class="post-warp {{.Data.Plural}}"> + <h2 class="post-title" style="text-align:right;padding-bottom:2em"> + {{- printf "- %s -" $taxonomysName -}} + </h2> + + <!-- Categories Page --> + {{ if eq $taxonomy "category" }} + <div class="categories-card"> + {{ range $terms }} + {{ $term := .Term }} + {{ $pages := .Pages }} + {{ with $.Site.GetPage "taxonomy" (printf "%s/%s" $type $term) }} + <div class="card-item"> + <div class="categories"> + <a href="{{ .Permalink }}"> + <h3> <i class="iconfont icon-folder" style="padding-right: 3px"></i> {{ $term | humanize}} </h3> + </a> + {{ range first 5 $pages }} + <article class="archive-item"> + <a href="{{ .Permalink }}" class="archive-item-link">{{ .Title }}</a> + </article> + {{ end }} + {{ if gt (len $pages) 5 }} + <span class="more-post"> + <a href="{{ .Permalink }}" class="more-post-link">{{ T "More" }} >></a> + </span> + {{ end }} + </div> + </div> + {{ end }} + {{ end }} + </div> + + <!-- Tag Cloud Page --> + {{ else if eq $taxonomy "tag" }} + <div class="tag-cloud-tags"> + {{ range $.Site.Taxonomies.tags.ByCount }} + {{ if .Name }} + <a href="/tags/{{ .Name | urlize}}/"> {{ .Name }} <small>({{ .Count }})</small></a> + {{ end }} + {{end}} + </div> + + {{ end }} + </div> +{{end }} |