diff --git a/layouts/404.html b/layouts/404.html index 963ae583..234ac358 100644 --- a/layouts/404.html +++ b/layouts/404.html @@ -1,19 +1,19 @@ {{- define "title" }} - {{- T "pageNotFound" | printf "404 %v" }} - {{ .Site.Title -}} + {{- T "pageNotFound" | printf "404 %v" }} - {{ .Site.Title -}} {{- end -}} {{- define "content" -}} -
-

-

- {{- T "pageNotFoundText" -}}  - -

-
- +
+

+

+ {{- T "pageNotFoundText" -}}  + +

+
+ {{- end -}} diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html index a79cddf0..748da74a 100644 --- a/layouts/_default/_markup/render-image.html +++ b/layouts/_default/_markup/render-image.html @@ -1,10 +1,10 @@ {{- if .Title -}} -
- {{- dict "Src" .Destination "Title" .Text "Caption" .Title "Linked" true "Resources" .Page.Resources | partial "plugin/image.html" -}} -
- {{- .Title | safeHTML -}} -
-
+
+ {{- dict "Src" .Destination "Title" .Text "Caption" .Title "Linked" true "Resources" .Page.Resources | partial "plugin/image.html" -}} +
+ {{- .Title | safeHTML -}} +
+
{{- else -}} - {{- dict "Src" .Destination "Title" .Text "Resources" .Page.Resources | partial "plugin/image.html" -}} + {{- dict "Src" .Destination "Title" .Text "Resources" .Page.Resources | partial "plugin/image.html" -}} {{- end -}} diff --git a/layouts/_default/_markup/render-link.html b/layouts/_default/_markup/render-link.html index 0c053962..10f9ca30 100644 --- a/layouts/_default/_markup/render-link.html +++ b/layouts/_default/_markup/render-link.html @@ -1,6 +1,6 @@ {{- $destination := .Destination -}} {{- with dict "Path" $destination "Resources" .Page.Resources | partial "function/resource.html" -}} - {{- $destination = .RelPermalink -}} + {{- $destination = .RelPermalink -}} {{- end -}} {{- $options := dict "Destination" $destination "Title" .Title "Content" .Text -}} {{- partial "plugin/link.html" $options -}} diff --git a/layouts/_default/section.html b/layouts/_default/section.html index 56943174..59165653 100644 --- a/layouts/_default/section.html +++ b/layouts/_default/section.html @@ -1,36 +1,36 @@ {{- define "title" }} - {{- .Params.Title | default (T .Section) | default .Section | dict "Some" | T "allSome" }} - {{ .Site.Title -}} + {{- .Params.Title | default (T .Section) | default .Section | dict "Some" | T "allSome" }} - {{ .Site.Title -}} {{- end -}} {{- define "content" -}} -
- {{- /* Title */ -}} -

- {{- .Params.Title | default (T .Section) | default .Section | dict "Some" | T "allSome" -}} -

+
+ {{- /* Title */ -}} +

+ {{- .Params.Title | default (T .Section) | default .Section | dict "Some" | T "allSome" -}} +

- {{- /* Paginate */ -}} - {{- if .Pages -}} - {{- $pages := .Pages.GroupByDate "2006" -}} - {{- with .Site.Params.section.paginate | default .Site.Params.paginate -}} - {{- $pages = $.Paginate $pages . -}} - {{- else -}} - {{- $pages = .Paginate $pages -}} - {{- end -}} - {{- range $pages.PageGroups -}} -

{{ .Key }}

- {{- range .Pages -}} -
- - {{- .Title -}} - - - {{- $.Site.Params.section.dateFormat | default "01-02" | .Date.Format -}} - -
- {{- end -}} - {{- end -}} - {{- partial "paginator.html" . -}} + {{- /* Paginate */ -}} + {{- if .Pages -}} + {{- $pages := .Pages.GroupByDate "2006" -}} + {{- with .Site.Params.section.paginate | default .Site.Params.paginate -}} + {{- $pages = $.Paginate $pages . -}} + {{- else -}} + {{- $pages = .Paginate $pages -}} + {{- end -}} + {{- range $pages.PageGroups -}} +

{{ .Key }}

+ {{- range .Pages -}} +
+ + {{- .Title -}} + + + {{- $.Site.Params.section.dateFormat | default "01-02" | .Date.Format -}} + +
{{- end -}} -
+ {{- end -}} + {{- partial "paginator.html" . -}} + {{- end -}} +
{{- end -}} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index a34e22bd..2b090d9e 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -1,24 +1,24 @@ {{- define "title" }}{{ .Title }} - {{ .Site.Title }}{{ end -}} {{- define "content" -}} - {{- $params := .Scratch.Get "params" -}} -
- {{- /* Title */ -}} -

- {{- .Title -}} -

+ {{- $params := .Scratch.Get "params" -}} +
+ {{- /* Title */ -}} +

+ {{- .Title -}} +

- {{- /* Subtitle */ -}} - {{- with $params.subtitle -}} -

{{ . }}

- {{- end -}} + {{- /* Subtitle */ -}} + {{- with $params.subtitle -}} +

{{ . }}

+ {{- end -}} - {{- /* Content */ -}} -
- {{- dict "Content" .Content "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}} -
- - {{- /* Comment */ -}} - {{- partial "comment.html" . -}} + {{- /* Content */ -}} +
+ {{- dict "Content" .Content "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}}
+ + {{- /* Comment */ -}} + {{- partial "comment.html" . -}} +
{{- end -}} diff --git a/layouts/_default/summary.html b/layouts/_default/summary.html index 990b6a9e..06cbc99d 100644 --- a/layouts/_default/summary.html +++ b/layouts/_default/summary.html @@ -1,75 +1,75 @@ {{- $params := .Params | merge .Site.Params.page -}}
- {{- /* Featured image */ -}} - {{- $image := $params.featuredimagepreview | default $params.featuredimage -}} - {{- with .Resources.GetMatch "featured-image" -}} - {{- $image = .RelPermalink -}} - {{- end -}} - {{- with .Resources.GetMatch "featured-image-preview" -}} - {{- $image = .RelPermalink -}} - {{- end -}} - {{- with $image -}} - + {{- /* Featured image */ -}} + {{- $image := $params.featuredimagepreview | default $params.featuredimage -}} + {{- with .Resources.GetMatch "featured-image" -}} + {{- $image = .RelPermalink -}} + {{- end -}} + {{- with .Resources.GetMatch "featured-image-preview" -}} + {{- $image = .RelPermalink -}} + {{- end -}} + {{- with $image -}} + + {{- end -}} + + {{- /* Title */ -}} +

+ {{ .Title }} +

+ + {{- /* Meta */ -}} + - {{- /* Meta */ -}} -
\ No newline at end of file diff --git a/layouts/index.html b/layouts/index.html index 44dd92a4..6a42d1d2 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -1,41 +1,41 @@ {{- define "content" -}} - {{- $params := .Scratch.Get "params" -}} - {{- $profile := .Site.Params.home.profile -}} - {{- $posts := .Site.Params.home.posts -}} + {{- $params := .Scratch.Get "params" -}} + {{- $profile := .Site.Params.home.profile -}} + {{- $posts := .Site.Params.home.posts -}} -
- {{- /* Profile */ -}} - {{- if ne $profile.enable false -}} - {{- partial "home/profile.html" . -}} - {{- end -}} +
+ {{- /* Profile */ -}} + {{- if ne $profile.enable false -}} + {{- partial "home/profile.html" . -}} + {{- end -}} - {{- /* Content */ -}} - {{- if .Content -}} -
-
- {{- dict "Content" .Content "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}} -
-
- {{- end -}} + {{- /* Content */ -}} + {{- if .Content -}} +
+
+ {{- dict "Content" .Content "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}} +
+
+ {{- end -}} - {{- /* Posts */ -}} - {{- if ne $posts.enable false | and .Site.RegularPages -}} - {{- /* Paginate */ -}} - {{- $pages := where .Site.RegularPages "Type" "posts" -}} - {{- if .Site.Params.page.hiddenFromHomePage -}} - {{- $pages = where $pages "Params.hiddenfromhomepage" false -}} - {{- else -}} - {{- $pages = where $pages "Params.hiddenfromhomepage" "!=" true -}} - {{- end -}} - {{- with $posts.paginate | default .Site.Params.paginate -}} - {{- $pages = $.Paginate $pages . -}} - {{- else -}} - {{- $pages = .Paginate $pages -}} - {{- end -}} - {{- range $pages.Pages -}} - {{- .Render "summary" -}} - {{- end -}} - {{- partial "paginator.html" . -}} - {{- end -}} -
+ {{- /* Posts */ -}} + {{- if ne $posts.enable false | and .Site.RegularPages -}} + {{- /* Paginate */ -}} + {{- $pages := where .Site.RegularPages "Type" "posts" -}} + {{- if .Site.Params.page.hiddenFromHomePage -}} + {{- $pages = where $pages "Params.hiddenfromhomepage" false -}} + {{- else -}} + {{- $pages = where $pages "Params.hiddenfromhomepage" "!=" true -}} + {{- end -}} + {{- with $posts.paginate | default .Site.Params.paginate -}} + {{- $pages = $.Paginate $pages . -}} + {{- else -}} + {{- $pages = .Paginate $pages -}} + {{- end -}} + {{- range $pages.Pages -}} + {{- .Render "summary" -}} + {{- end -}} + {{- partial "paginator.html" . -}} + {{- end -}} +
{{- end -}} diff --git a/layouts/index.rss.xml b/layouts/index.rss.xml index 355c26a5..8be1d176 100644 --- a/layouts/index.rss.xml +++ b/layouts/index.rss.xml @@ -1,43 +1,43 @@ - - - {{- .Site.Title -}} - - - {{- .Permalink -}} - - - {{- .Site.Params.description | default .Site.Title -}} - - Hugo -- gohugo.io - {{- with .Site.LanguageCode -}} - - {{- . -}} - - {{- end -}} - {{- with .Site.Author.email -}} - - {{- . }}{{ with $.Site.Author.name }} ({{ . }}){{ end -}} - - - {{- . }}{{ with $.Site.Author.name }} ({{ . }}){{ end -}} - - {{- end -}} - {{- with .Site.Copyright -}} - - {{- . -}} - - {{- end -}} - {{- if not .Date.IsZero -}} - - {{- .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" -}} - - {{- end -}} - {{ with .OutputFormats.Get "RSS" }} - {{ printf "" .Permalink .MediaType | safeHTML }} - {{ end }} - {{- range where .Site.RegularPages "Type" "posts" | first (.Site.Params.home.rss | default 10) -}} - {{- dict "Page" . "Site" .Site | partial "rss/item.html" -}} - {{- end -}} - + + + {{- .Site.Title -}} + + + {{- .Permalink -}} + + + {{- .Site.Params.description | default .Site.Title -}} + + Hugo -- gohugo.io + {{- with .Site.LanguageCode -}} + + {{- . -}} + + {{- end -}} + {{- with .Site.Author.email -}} + + {{- . }}{{ with $.Site.Author.name }} ({{ . }}){{ end -}} + + + {{- . }}{{ with $.Site.Author.name }} ({{ . }}){{ end -}} + + {{- end -}} + {{- with .Site.Copyright -}} + + {{- . -}} + + {{- end -}} + {{- if not .Date.IsZero -}} + + {{- .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" -}} + + {{- end -}} + {{ with .OutputFormats.Get "RSS" }} + {{ printf "" .Permalink .MediaType | safeHTML }} + {{ end }} + {{- range where .Site.RegularPages "Type" "posts" | first (.Site.Params.home.rss | default 10) -}} + {{- dict "Page" . "Site" .Site | partial "rss/item.html" -}} + {{- end -}} + diff --git a/layouts/partials/comment.html b/layouts/partials/comment.html index 0382ae11..95073a6d 100644 --- a/layouts/partials/comment.html +++ b/layouts/partials/comment.html @@ -4,127 +4,127 @@ {{- $commentConfig := dict -}} {{- if $comment.enable -}} -
- {{- /* Disqus Comment System */ -}} - {{- $disqus := $comment.disqus | default dict -}} - {{- if $disqus.enable -}} -
- {{- $source := printf "https://%v.disqus.com/embed.js" $disqus.shortname -}} - {{- dict "Source" $source "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} - - {{- end -}} +
+ {{- /* Disqus Comment System */ -}} + {{- $disqus := $comment.disqus | default dict -}} + {{- if $disqus.enable -}} +
+ {{- $source := printf "https://%v.disqus.com/embed.js" $disqus.shortname -}} + {{- dict "Source" $source "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} + + {{- end -}} - {{- /* Gitalk Comment System */ -}} - {{- $gitalk := $comment.gitalk | default dict -}} - {{- if $gitalk.enable -}} -
- {{- $source := $cdn.gitalkCSS | default "lib/gitalk/gitalk.css" -}} - {{- dict "Source" $source "Minify" true "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}} - {{- $source := $cdn.gitalkJS | default "lib/gitalk/gitalk.min.js" -}} - {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} - {{- $commentConfig = dict "id" .Date "title" .Title "clientID" $gitalk.clientId "clientSecret" $gitalk.clientSecret "repo" $gitalk.repo "owner" $gitalk.owner "admin" (slice $gitalk.owner) | dict "gitalk" | merge $commentConfig -}} - - {{- end -}} + {{- /* Gitalk Comment System */ -}} + {{- $gitalk := $comment.gitalk | default dict -}} + {{- if $gitalk.enable -}} +
+ {{- $source := $cdn.gitalkCSS | default "lib/gitalk/gitalk.css" -}} + {{- dict "Source" $source "Minify" true "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}} + {{- $source := $cdn.gitalkJS | default "lib/gitalk/gitalk.min.js" -}} + {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} + {{- $commentConfig = dict "id" .Date "title" .Title "clientID" $gitalk.clientId "clientSecret" $gitalk.clientSecret "repo" $gitalk.repo "owner" $gitalk.owner "admin" (slice $gitalk.owner) | dict "gitalk" | merge $commentConfig -}} + + {{- end -}} - {{- /* Valine Comment System */ -}} - {{- $valine := $comment.valine | default dict -}} - {{- if $valine.enable -}} -
- {{- $options := dict "targetPath" "lib/valine/valine.min.css" -}} - {{- dict "Source" "lib/valine/valine.scss" "ToCSS" $options | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}} - {{- $source := $cdn.valineJS | default "lib/valine/Valine.min.js" -}} - {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} - {{- $commentConfig = dict "el" "#valine" "appId" $valine.appId "appKey" $valine.appKey "lang" ($valine.lang | default (T "valineLang")) "visitor" $valine.visitor "recordIP" $valine.recordIP "placeholder" ($valine.placeholder | default (T "valinePlaceholder")) "highlight" (ne $valine.highlight false) "enableQQ" $valine.enableQQ | dict "valine" | merge $commentConfig -}} - {{- with $valine.avatar -}} - {{- $commentConfig = dict "avatar" . | dict "valine" | merge $commentConfig -}} - {{- end -}} - {{- with $valine.meta -}} - {{- $commentConfig = dict "meta" . | dict "valine" | merge $commentConfig -}} - {{- end -}} - {{- with $valine.pageSize -}} - {{- $commentConfig = dict "pageSize" . | dict "valine" | merge $commentConfig -}} - {{- end -}} - {{- with $valine.serverURLs -}} - {{- $commentConfig = dict "serverURLs" . | dict "valine" | merge $commentConfig -}} - {{- end -}} - {{- $commentConfig = $valine.emoji | default "google.yml" | printf "data/emoji/%v" | resources.Get | transform.Unmarshal | dict "valine" | merge $commentConfig -}} - - {{- end -}} + {{- /* Valine Comment System */ -}} + {{- $valine := $comment.valine | default dict -}} + {{- if $valine.enable -}} +
+ {{- $options := dict "targetPath" "lib/valine/valine.min.css" -}} + {{- dict "Source" "lib/valine/valine.scss" "ToCSS" $options | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}} + {{- $source := $cdn.valineJS | default "lib/valine/Valine.min.js" -}} + {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} + {{- $commentConfig = dict "el" "#valine" "appId" $valine.appId "appKey" $valine.appKey "lang" ($valine.lang | default (T "valineLang")) "visitor" $valine.visitor "recordIP" $valine.recordIP "placeholder" ($valine.placeholder | default (T "valinePlaceholder")) "highlight" (ne $valine.highlight false) "enableQQ" $valine.enableQQ | dict "valine" | merge $commentConfig -}} + {{- with $valine.avatar -}} + {{- $commentConfig = dict "avatar" . | dict "valine" | merge $commentConfig -}} + {{- end -}} + {{- with $valine.meta -}} + {{- $commentConfig = dict "meta" . | dict "valine" | merge $commentConfig -}} + {{- end -}} + {{- with $valine.pageSize -}} + {{- $commentConfig = dict "pageSize" . | dict "valine" | merge $commentConfig -}} + {{- end -}} + {{- with $valine.serverURLs -}} + {{- $commentConfig = dict "serverURLs" . | dict "valine" | merge $commentConfig -}} + {{- end -}} + {{- $commentConfig = $valine.emoji | default "google.yml" | printf "data/emoji/%v" | resources.Get | transform.Unmarshal | dict "valine" | merge $commentConfig -}} + + {{- end -}} - {{- /* Facebook Comment System */ -}} - {{- $facebook := $comment.facebook | default dict -}} - {{- if $facebook.enable -}} -
-
- {{- $source := printf "https://connect.facebook.net/%v/sdk.js#xfbml=1&version=v5.0&appId=%v&autoLogAppEvents=1" ($facebook.languageCode | default (T "facebookLanguageCode")) $facebook.appId -}} - {{- dict "Source" $source "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} - - {{- end -}} + {{- /* Facebook Comment System */ -}} + {{- $facebook := $comment.facebook | default dict -}} + {{- if $facebook.enable -}} +
+
+ {{- $source := printf "https://connect.facebook.net/%v/sdk.js#xfbml=1&version=v5.0&appId=%v&autoLogAppEvents=1" ($facebook.languageCode | default (T "facebookLanguageCode")) $facebook.appId -}} + {{- dict "Source" $source "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} + + {{- end -}} - {{- /* Telegram Comments System */ -}} - {{- $telegram := $comment.telegram | default dict -}} - {{- if $telegram.enable -}} -
- {{- $attr := printf `data-comments-app-website="%v"` $telegram.siteID -}} - {{- $attr = printf `%v data-limit="%v"` $attr ($telegram.limit | default 5) -}} - {{- with $telegram.height -}} - {{- $attr = printf `%v data-height="%v"` $attr . -}} - {{- end -}} - {{- with $telegram.color -}} - {{- $attr = printf `%v data-color="%v"` $attr . -}} - {{- end -}} - {{- if $telegram.colorful -}} - {{- $attr = printf `%v data-colorful="1"` $attr -}} - {{- end -}} - {{- if $telegram.dislikes -}} - {{- $attr = printf `%v data-dislikes="1"` $attr -}} - {{- end -}} - {{- if $telegram.outlined -}} - {{- $attr = printf `%v data-outlined="1"` $attr -}} - {{- end -}} - {{- dict "Source" "https://comments.app/js/widget.js?2" "Defer" true "Attr" $attr | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} - - {{- end -}} + {{- /* Telegram Comments System */ -}} + {{- $telegram := $comment.telegram | default dict -}} + {{- if $telegram.enable -}} +
+ {{- $attr := printf `data-comments-app-website="%v"` $telegram.siteID -}} + {{- $attr = printf `%v data-limit="%v"` $attr ($telegram.limit | default 5) -}} + {{- with $telegram.height -}} + {{- $attr = printf `%v data-height="%v"` $attr . -}} + {{- end -}} + {{- with $telegram.color -}} + {{- $attr = printf `%v data-color="%v"` $attr . -}} + {{- end -}} + {{- if $telegram.colorful -}} + {{- $attr = printf `%v data-colorful="1"` $attr -}} + {{- end -}} + {{- if $telegram.dislikes -}} + {{- $attr = printf `%v data-dislikes="1"` $attr -}} + {{- end -}} + {{- if $telegram.outlined -}} + {{- $attr = printf `%v data-outlined="1"` $attr -}} + {{- end -}} + {{- dict "Source" "https://comments.app/js/widget.js?2" "Defer" true "Attr" $attr | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} + + {{- end -}} - {{- /* Commento Comment System */ -}} - {{- $commento := $comment.commento | default dict -}} - {{- if $commento.enable -}} -
- {{- dict "Source" "https://cdn.commento.io/js/commento.js" "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} - - {{- end -}} + {{- /* Commento Comment System */ -}} + {{- $commento := $comment.commento | default dict -}} + {{- if $commento.enable -}} +
+ {{- dict "Source" "https://cdn.commento.io/js/commento.js" "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} + + {{- end -}} - {{- /* Utterances Comment System */ -}} - {{- $utterances := $comment.utterances | default dict -}} - {{- if $utterances.enable -}} -
- {{- $commentConfig = dict "repo" $utterances.repo | dict "utterances" | merge $commentConfig -}} - {{- $commentConfig = $utterances.issueTerm | default "pathname" | dict "issueTerm" | dict "utterances" | merge $commentConfig -}} - {{- $commentConfig = dict "label" $utterances.label | dict "utterances" | merge $commentConfig -}} - {{- $commentConfig = $utterances.lightTheme | default "github-light" | dict "lightTheme" | dict "utterances" | merge $commentConfig -}} - {{- $commentConfig = $utterances.darkTheme | default "github-dark" | dict "darkTheme" | dict "utterances" | merge $commentConfig -}} - - {{- end -}} -
+ {{- /* Utterances Comment System */ -}} + {{- $utterances := $comment.utterances | default dict -}} + {{- if $utterances.enable -}} +
+ {{- $commentConfig = dict "repo" $utterances.repo | dict "utterances" | merge $commentConfig -}} + {{- $commentConfig = $utterances.issueTerm | default "pathname" | dict "issueTerm" | dict "utterances" | merge $commentConfig -}} + {{- $commentConfig = dict "label" $utterances.label | dict "utterances" | merge $commentConfig -}} + {{- $commentConfig = $utterances.lightTheme | default "github-light" | dict "lightTheme" | dict "utterances" | merge $commentConfig -}} + {{- $commentConfig = $utterances.darkTheme | default "github-dark" | dict "darkTheme" | dict "utterances" | merge $commentConfig -}} + + {{- end -}} +
{{- end -}} {{- dict "comment" $commentConfig | dict "config" | merge (.Scratch.Get "this") | .Scratch.Set "this" -}} diff --git a/layouts/partials/function/id.html b/layouts/partials/function/id.html index e84ef9c2..a423e1d7 100644 --- a/layouts/partials/function/id.html +++ b/layouts/partials/function/id.html @@ -3,6 +3,6 @@ {{- $id := printf "id-%d" $count -}} {{- $count | add 1 | .Scratch.SetInMap "this" "count" -}} {{- with .Content -}} - {{- dict $id . | dict "data" | dict "config" | merge ($.Scratch.Get "this") | $.Scratch.Set "this" -}} + {{- dict $id . | dict "data" | dict "config" | merge ($.Scratch.Get "this") | $.Scratch.Set "this" -}} {{- end -}} {{- return $id -}} diff --git a/layouts/partials/function/resource.html b/layouts/partials/function/resource.html index 2febef3f..648b2664 100644 --- a/layouts/partials/function/resource.html +++ b/layouts/partials/function/resource.html @@ -1,16 +1,16 @@ {{- $resource := 0 -}} {{- $url := urls.Parse .Path -}} {{- if not $url.Host | and $url.Path | and (strings.HasSuffix $url.Path "/" | not) -}} - {{- if .Resources -}} - {{- with .Resources.GetMatch $url.Path -}} - {{- $resource = . -}} - {{- end -}} + {{- if .Resources -}} + {{- with .Resources.GetMatch $url.Path -}} + {{- $resource = . -}} {{- end -}} - {{- if not $resource -}} - {{- with resources.Get $url.Path -}} - {{- $resource = . -}} - {{- end -}} + {{- end -}} + {{- if not $resource -}} + {{- with resources.Get $url.Path -}} + {{- $resource = . -}} {{- end -}} + {{- end -}} {{- end -}} {{- return $resource -}} diff --git a/layouts/partials/head/link.html b/layouts/partials/head/link.html index 080a1f9c..e82c7f89 100644 --- a/layouts/partials/head/link.html +++ b/layouts/partials/head/link.html @@ -2,31 +2,31 @@ {{- $fingerprint := .Scratch.Get "fingerprint" -}} {{- if not .Site.Params.app.noFavicon -}} - {{- with .Site.Params.app.svgFavicon -}} - - {{- else -}} - - - - {{- end -}} - - {{- with .Site.Params.app.iconColor -}} - - {{- end -}} - + {{- with .Site.Params.app.svgFavicon -}} + + {{- else -}} + + + + {{- end -}} + + {{- with .Site.Params.app.iconColor -}} + + {{- end -}} + {{- end -}} {{- if .PrevInSection -}} - + {{- end -}} {{- if .NextInSection -}} - + {{- end -}} {{- with .OutputFormats.Get "RSS" -}} - - + + {{- end -}} {{- /* normalize.css */ -}} diff --git a/layouts/partials/head/seo.html b/layouts/partials/head/seo.html index d431ad06..08795922 100644 --- a/layouts/partials/head/seo.html +++ b/layouts/partials/head/seo.html @@ -1,153 +1,153 @@ {{- $params := .Scratch.Get "params" -}} {{- with .Site.Params.verification.google -}} - + {{- end -}} {{- with .Site.Params.verification.bing -}} - + {{- end -}} {{- with .Site.Params.verification.yandex -}} - + {{- end -}} {{- with .Site.Params.verification.pinterest -}} - + {{- end -}} {{- with .Site.Params.verification.baidu -}} - + {{- end -}} {{- /* Home SEO */ -}} {{- if .IsHome -}} - + "width": {{ .Width }}, + "height": {{ .Height }} + }, + {{- else -}} + {{- with $image -}} + "image": "{{ . | absURL }}", + {{- end -}} + {{- end -}} + {{- with .Site.Params.seo.thumbnailUrl -}} + {{- with dict "Path" . "Resources" $.Resources | partial "function/resource.html" -}} + "thumbnailUrl": "{{ .Permalink }}", + {{- else -}} + "thumbnailUrl": "{{ . | absURL }}", + {{- end -}} + {{- end -}} + {{- with .Site.Copyright -}} + "license": "{{ . | safeHTML }}", + {{- end -}} + "name": {{ .Site.Title | safeHTML }} + } + {{- /* Page SEO */ -}} {{- else if .IsPage -}} - + {{- end -}} + }, + {{- with .Params.author | default .Site.Author.name | default (T "author") -}} + "author": { + "@type": "Person", + "name": {{ . | safeHTML }} + }, + {{- end -}} + "description": {{ .Description | safeHTML }} + } + {{- end -}} diff --git a/layouts/partials/home/profile.html b/layouts/partials/home/profile.html index b37e1528..b1433156 100644 --- a/layouts/partials/home/profile.html +++ b/layouts/partials/home/profile.html @@ -1,95 +1,95 @@ {{- $profile := .Site.Params.home.profile -}}
- {{- $avatar := $profile.avatarURL -}} - {{- with $profile.gravatarEmail -}} - {{- $avatar = md5 . | printf "https://www.gravatar.com/avatar/%v?s=240&d=mp" -}} - {{- end -}} - {{- if $avatar -}} -
- {{- $menus := $.Site.Menus.main | default slice -}} - {{- with index $menus 0 -}} - {{- $url := .URL | relLangURL -}} - {{- with .Page -}} - {{- $url = .RelPermalink -}} - {{- end -}} - - {{- dict "Src" $avatar | partial "plugin/image.html" -}} - - {{- else -}} - {{- dict "Src" $avatar | partial "plugin/image.html" -}} - {{- end -}} -
- {{- end -}} + {{- $avatar := $profile.avatarURL -}} + {{- with $profile.gravatarEmail -}} + {{- $avatar = md5 . | printf "https://www.gravatar.com/avatar/%v?s=240&d=mp" -}} + {{- end -}} + {{- if $avatar -}} +
+ {{- $menus := $.Site.Menus.main | default slice -}} + {{- with index $menus 0 -}} + {{- $url := .URL | relLangURL -}} + {{- with .Page -}} + {{- $url = .RelPermalink -}} + {{- end -}} + + {{- dict "Src" $avatar | partial "plugin/image.html" -}} + + {{- else -}} + {{- dict "Src" $avatar | partial "plugin/image.html" -}} + {{- end -}} +
+ {{- end -}} - {{- with $profile.title -}} -

- {{- . | safeHTML -}} -

- {{- end -}} + {{- with $profile.title -}} +

+ {{- . | safeHTML -}} +

+ {{- end -}} - {{- with $profile.subtitle -}} -

- {{- if $profile.typeit -}} - {{- $id := dict "Content" . "Scratch" $.Scratch | partial "function/id.html" -}} -
- {{- dict $id (slice $id) | dict "typeitMap" | merge ($.Scratch.Get "this") | $.Scratch.Set "this" -}} - {{- else -}} - {{- . -}} - {{- end -}} -

- {{- end -}} + {{- with $profile.subtitle -}} +

+ {{- if $profile.typeit -}} + {{- $id := dict "Content" . "Scratch" $.Scratch | partial "function/id.html" -}} +
+ {{- dict $id (slice $id) | dict "typeitMap" | merge ($.Scratch.Get "this") | $.Scratch.Set "this" -}} + {{- else -}} + {{- . -}} + {{- end -}} +

+ {{- end -}} - {{- if $profile.social -}} - + {{- end -}} - {{- with $profile.disclaimer -}} -

- {{- . | safeHTML -}} -

- {{- end -}} + {{- with $profile.disclaimer -}} +

+ {{- . | safeHTML -}} +

+ {{- end -}}
diff --git a/layouts/partials/init.html b/layouts/partials/init.html index 28fdd77f..9b76da9b 100644 --- a/layouts/partials/init.html +++ b/layouts/partials/init.html @@ -3,36 +3,36 @@ {{- /* FixIt theme version detection */ -}} {{- $VERSION := "0.2.X" -}} {{- if eq .Site .Sites.First -}} - {{- if not .Site.Params.version -}} - {{- errorf "Configuration Error 配置文件错误\n\nYou haven't configured the FixIt version param correctly yet. See https://hugoloveit.com/theme-documentation-basics/#basic-configuration\n你还没有正确配置 FixIt 的版本参数. 参考 https://hugoloveit.com/zh-cn/theme-documentation-basics/#basic-configuration\n" -}} - {{- else if ne .Site.Params.version $VERSION -}} - {{- errorf (printf "Compatibility Error 兼容性错误\n\n%v -> %v:\nYou have an incompatible update. See https://github.com/Lruihao/FixIt/releases\n你进行了一次不兼容的更新. 参考 https://github.com/Lruihao/FixIt/releases\n" .Site.Params.version $VERSION) -}} - {{- end -}} + {{- if not .Site.Params.version -}} + {{- errorf "Configuration Error 配置文件错误\n\nYou haven't configured the FixIt version param correctly yet. See https://hugoloveit.com/theme-documentation-basics/#basic-configuration\n你还没有正确配置 FixIt 的版本参数. 参考 https://hugoloveit.com/zh-cn/theme-documentation-basics/#basic-configuration\n" -}} + {{- else if ne .Site.Params.version $VERSION -}} + {{- errorf (printf "Compatibility Error 兼容性错误\n\n%v -> %v:\nYou have an incompatible update. See https://github.com/Lruihao/FixIt/releases\n你进行了一次不兼容的更新. 参考 https://github.com/Lruihao/FixIt/releases\n" .Site.Params.version $VERSION) -}} + {{- end -}} {{- end -}} {{- $params := .Params | merge .Site.Params.page -}} {{- if eq hugo.Environment "production" -}} - {{- $cdn := .Site.Params.cdn -}} - {{- with $cdn.data -}} - {{- $cdnData := printf "data/cdn/%v" . | resources.Get | transform.Unmarshal -}} - {{- $cdn = dict "simpleIconsPrefix" $cdnData.prefix.simpleIcons -}} - {{- $prefix := $cdnData.prefix.libFiles | default "" -}} - {{- range $key, $value := $cdnData.libFiles -}} - {{- $cdn = printf "%v%v" $prefix $value | dict $key | merge $cdn -}} - {{- end -}} - {{- end -}} - {{- .Scratch.Set "cdn" $cdn -}} - {{- .Scratch.Set "fingerprint" .Site.Params.fingerprint -}} - {{- .Scratch.Set "analytics" .Site.Params.analytics -}} - {{- .Scratch.Set "comment" $params.comment -}} - {{- if eq .Params.comment true -}} - {{- .Scratch.Set "comment" .Site.Params.comment -}} - {{- else if eq .Params.comment false -}} - {{- .Scratch.Set "comment" dict -}} + {{- $cdn := .Site.Params.cdn -}} + {{- with $cdn.data -}} + {{- $cdnData := printf "data/cdn/%v" . | resources.Get | transform.Unmarshal -}} + {{- $cdn = dict "simpleIconsPrefix" $cdnData.prefix.simpleIcons -}} + {{- $prefix := $cdnData.prefix.libFiles | default "" -}} + {{- range $key, $value := $cdnData.libFiles -}} + {{- $cdn = printf "%v%v" $prefix $value | dict $key | merge $cdn -}} {{- end -}} + {{- end -}} + {{- .Scratch.Set "cdn" $cdn -}} + {{- .Scratch.Set "fingerprint" .Site.Params.fingerprint -}} + {{- .Scratch.Set "analytics" .Site.Params.analytics -}} + {{- .Scratch.Set "comment" $params.comment -}} + {{- if eq .Params.comment true -}} + {{- .Scratch.Set "comment" .Site.Params.comment -}} + {{- else if eq .Params.comment false -}} + {{- .Scratch.Set "comment" dict -}} + {{- end -}} {{- else if eq .Site .Sites.First -}} - {{- warnf "\n\nCurrent environment is \"development\". The \"comment system\", \"CDN\" and \"fingerprint\" will be disabled.\n当前运行环境是 \"development\". \"评论系统\", \"CDN\" 和 \"fingerprint\" 不会启用.\n" -}} + {{- warnf "\n\nCurrent environment is \"development\". The \"comment system\", \"CDN\" and \"fingerprint\" will be disabled.\n当前运行环境是 \"development\". \"评论系统\", \"CDN\" 和 \"fingerprint\" 不会启用.\n" -}} {{- end -}} {{- .Scratch.Set "params" $params -}} diff --git a/layouts/partials/paginator.html b/layouts/partials/paginator.html index 170144fb..9eb7c25c 100644 --- a/layouts/partials/paginator.html +++ b/layouts/partials/paginator.html @@ -1,30 +1,30 @@ {{- if gt .Paginator.TotalPages 1 -}} - + {{- end -}} diff --git a/layouts/partials/plugin/analytics.html b/layouts/partials/plugin/analytics.html index c4c21fad..f08e85a1 100644 --- a/layouts/partials/plugin/analytics.html +++ b/layouts/partials/plugin/analytics.html @@ -1,22 +1,22 @@ {{- $analytics := .Scratch.Get "analytics" | default dict -}} {{- if $analytics.enable -}} - {{- /* Google Analytics */ -}} - {{- with $analytics.google.id -}} - - {{- printf "https://www.googletagmanager.com/gtag/js?id=%v" . | dict "Async" true "Source" | partial "plugin/script.html" -}} - {{- end -}} + {{- /* Google Analytics */ -}} + {{- with $analytics.google.id -}} + + {{- printf "https://www.googletagmanager.com/gtag/js?id=%v" . | dict "Async" true "Source" | partial "plugin/script.html" -}} + {{- end -}} - {{- /* Fathom Analytics */ -}} - {{- with $analytics.fathom.id -}} - - {{- dict "Source" ($analytics.fathom.server | default "cdn.usefathom.com" | printf "https://%v/tracker.js") "Async" true "Attr" "id=fathom-script" | partial "plugin/script.html" -}} - {{- end -}} + {{- /* Fathom Analytics */ -}} + {{- with $analytics.fathom.id -}} + + {{- dict "Source" ($analytics.fathom.server | default "cdn.usefathom.com" | printf "https://%v/tracker.js") "Async" true "Attr" "id=fathom-script" | partial "plugin/script.html" -}} + {{- end -}} {{- end -}} diff --git a/layouts/partials/plugin/cardlink.html b/layouts/partials/plugin/cardlink.html index 2fa65d1b..464d7ee3 100644 --- a/layouts/partials/plugin/cardlink.html +++ b/layouts/partials/plugin/cardlink.html @@ -4,17 +4,17 @@ - {{- with .Content -}} - {{- . | safeHTML -}} - {{- end -}} + {{- with .Content -}} + {{- . | safeHTML -}} + {{- end -}} - - - - - - {{ .Destination | safeURL }} + + + + + + {{ .Destination | safeURL }} diff --git a/layouts/partials/plugin/compatibility.html b/layouts/partials/plugin/compatibility.html index b460f185..46822cc2 100644 --- a/layouts/partials/plugin/compatibility.html +++ b/layouts/partials/plugin/compatibility.html @@ -4,19 +4,19 @@ {{- /* Polyfill.io */ -}} {{- if $compatibility.polyfill -}} - {{- $features := slice -}} - {{- range resources.Get "data/polyfill.yml" | transform.Unmarshal -}} - {{- range . -}} - {{- $features = $features | append . -}} - {{- end -}} - {{- end -}} - {{- with $features | uniq -}} - {{- delimit . "%2C" | printf "https://polyfill.io/v3/polyfill.min.js?features=%v" | dict "Source" | dict "Scratch" $.Scratch "Data" | partial "scratch/script.html" -}} + {{- $features := slice -}} + {{- range resources.Get "data/polyfill.yml" | transform.Unmarshal -}} + {{- range . -}} + {{- $features = $features | append . -}} {{- end -}} + {{- end -}} + {{- with $features | uniq -}} + {{- delimit . "%2C" | printf "https://polyfill.io/v3/polyfill.min.js?features=%v" | dict "Source" | dict "Scratch" $.Scratch "Data" | partial "scratch/script.html" -}} + {{- end -}} {{- end -}} {{- /* object-fit-images */ -}} {{- if $compatibility.objectFit -}} - {{- $source := $cdn.objectFitImagesJS | default "lib/object-fit-images/ofi.min.js" -}} - {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} + {{- $source := $cdn.objectFitImagesJS | default "lib/object-fit-images/ofi.min.js" -}} + {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- end -}} diff --git a/layouts/partials/plugin/icon.html b/layouts/partials/plugin/icon.html index 5bc2a11f..bd28a127 100644 --- a/layouts/partials/plugin/icon.html +++ b/layouts/partials/plugin/icon.html @@ -1,13 +1,13 @@ {{- with .Class -}} - + {{- else -}} - {{- $src := .Src -}} - {{- with .Simpleicons -}} - {{- $prefix := $.Prefix | default "lib/simple-icons/icons" | strings.TrimSuffix "/" -}} - {{- $src = printf "%v/%v.svg" $prefix . -}} - {{- end -}} - {{- if (urls.Parse $src).Host | not -}} - {{- $src = (resources.Get $src | minify).RelPermalink -}} - {{- end -}} - + {{- $src := .Src -}} + {{- with .Simpleicons -}} + {{- $prefix := $.Prefix | default "lib/simple-icons/icons" | strings.TrimSuffix "/" -}} + {{- $src = printf "%v/%v.svg" $prefix . -}} + {{- end -}} + {{- if (urls.Parse $src).Host | not -}} + {{- $src = (resources.Get $src | minify).RelPermalink -}} + {{- end -}} + {{- end -}} diff --git a/layouts/partials/plugin/image.html b/layouts/partials/plugin/image.html index 84a61b3e..3a6514db 100644 --- a/layouts/partials/plugin/image.html +++ b/layouts/partials/plugin/image.html @@ -1,38 +1,38 @@ {{- /* lazysizes and lightgallery.js */ -}} {{- $src := .Src -}} {{- with dict "Path" .Src "Resources" .Resources | partial "function/resource.html" -}} - {{- $src = .RelPermalink -}} + {{- $src = .RelPermalink -}} {{- end -}} {{- $small := .SrcSmall | default $src -}} {{- with dict "Path" .SrcSmall "Resources" .Resources | partial "function/resource.html" -}} - {{- $small = .RelPermalink -}} + {{- $small = .RelPermalink -}} {{- end -}} {{- $large := .SrcLarge | default $src -}} {{- with dict "Path" .SrcLarge "Resources" .Resources | partial "function/resource.html" -}} - {{- $large = .RelPermalink -}} + {{- $large = .RelPermalink -}} {{- end -}} {{- $alt := .Alt | default $src -}} {{- $loading := resources.Get "svg/loading.svg" | minify -}} {{- if .Linked -}} - - {{ $alt }} - -{{- else -}} + {{ $alt }} + class="lazyload{{ with .Class }} {{ . }}{{ end }}" + src="{{ $loading.RelPermalink }}" + data-src="{{ .Src | safeURL }}" + data-srcset="{{ $small | safeURL }}, {{ .Src | safeURL }} 1.5x, {{ $large | safeURL }} 2x" + data-sizes="auto" + alt="{{ $alt }}"{{ with .Height }} height="{{ . }}"{{ end }}{{ with .Width }} width="{{ . }}"{{ end }} /> + +{{- else -}} + {{ $alt }} {{- end -}} diff --git a/layouts/partials/plugin/link.html b/layouts/partials/plugin/link.html index ceaefc62..8fb7ff4e 100644 --- a/layouts/partials/plugin/link.html +++ b/layouts/partials/plugin/link.html @@ -1,9 +1,9 @@ {{- $rel := "" -}} - {{- with .Icon -}} - {{- partial "plugin/icon.html" . -}} - {{- end -}} - {{- with .Content -}} - {{- . | safeHTML -}} - {{- end -}} + {{- with .Icon -}} + {{- partial "plugin/icon.html" . -}} + {{- end -}} + {{- with .Content -}} + {{- . | safeHTML -}} + {{- end -}} \ No newline at end of file diff --git a/layouts/partials/plugin/script.html b/layouts/partials/plugin/script.html index e12e74e2..cb4ea122 100644 --- a/layouts/partials/plugin/script.html +++ b/layouts/partials/plugin/script.html @@ -1,25 +1,25 @@ {{- if .Content -}} - + {{- else if strings.HasPrefix .Source " + {{- if .Minify -}} + {{- $resource = $resource | minify -}} + {{- end -}} + {{- with .Fingerprint -}} + {{- $resource = $resource | fingerprint . -}} + {{- $integrity = $resource.Data.Integrity -}} + {{- end -}} + {{- $src = $resource.RelPermalink -}} + {{- end -}} + {{- end -}} diff --git a/layouts/partials/plugin/share.html b/layouts/partials/plugin/share.html index 941647cb..a3e94ef2 100644 --- a/layouts/partials/plugin/share.html +++ b/layouts/partials/plugin/share.html @@ -1,199 +1,199 @@ {{- $share := (.Scratch.Get "params").share | default dict -}} {{- if $share.enable -}} - {{- /* 001: Twitter */ -}} - {{- if $share.Twitter -}} - - {{- dict "Class" "fab fa-twitter fa-fw" | partial "plugin/icon.html" -}} - - {{- end -}} + {{- /* 001: Twitter */ -}} + {{- if $share.Twitter -}} + + {{- dict "Class" "fab fa-twitter fa-fw" | partial "plugin/icon.html" -}} + + {{- end -}} - {{- /* 002: Facebook */ -}} - {{- if $share.Facebook -}} - - {{- dict "Class" "fab fa-facebook-square fa-fw" | partial "plugin/icon.html" -}} - - {{- end -}} + {{- /* 002: Facebook */ -}} + {{- if $share.Facebook -}} + + {{- dict "Class" "fab fa-facebook-square fa-fw" | partial "plugin/icon.html" -}} + + {{- end -}} - {{- /* 003: Linkedin */ -}} - {{- if $share.Linkedin -}} - - {{- dict "Class" "fab fa-linkedin fa-fw" | partial "plugin/icon.html" -}} - - {{- end -}} + {{- /* 003: Linkedin */ -}} + {{- if $share.Linkedin -}} + + {{- dict "Class" "fab fa-linkedin fa-fw" | partial "plugin/icon.html" -}} + + {{- end -}} - {{- /* 004: WhatsApp */ -}} - {{- if $share.Whatsapp -}} - - {{- dict "Class" "fab fa-whatsapp fa-fw" | partial "plugin/icon.html" -}} - - {{- end -}} + {{- /* 004: WhatsApp */ -}} + {{- if $share.Whatsapp -}} + + {{- dict "Class" "fab fa-whatsapp fa-fw" | partial "plugin/icon.html" -}} + + {{- end -}} - {{- /* 005: Viber */ -}} - {{- if $share.Viber -}} - - {{- dict "Class" "fab fa-viber fa-fw" | partial "plugin/icon.html" -}} - - {{- end -}} + {{- /* 005: Viber */ -}} + {{- if $share.Viber -}} + + {{- dict "Class" "fab fa-viber fa-fw" | partial "plugin/icon.html" -}} + + {{- end -}} - {{- /* 006: Pinterest */ -}} - {{- if $share.Pinterest -}} - - {{- dict "Class" "fab fa-pinterest fa-fw" | partial "plugin/icon.html" -}} - - {{- end -}} + {{- /* 006: Pinterest */ -}} + {{- if $share.Pinterest -}} + + {{- dict "Class" "fab fa-pinterest fa-fw" | partial "plugin/icon.html" -}} + + {{- end -}} - {{- /* 007: Tumblr */ -}} - {{- if $share.Tumblr -}} - - {{- dict "Class" "fab fa-tumblr fa-fw" | partial "plugin/icon.html" -}} - - {{- end -}} + {{- /* 007: Tumblr */ -}} + {{- if $share.Tumblr -}} + + {{- dict "Class" "fab fa-tumblr fa-fw" | partial "plugin/icon.html" -}} + + {{- end -}} - {{- /* 008: Hacker News */ -}} - {{- if $share.Hackernews -}} - - {{- dict "Class" "fab fa-hacker-news fa-fw" | partial "plugin/icon.html" -}} - - {{- end -}} + {{- /* 008: Hacker News */ -}} + {{- if $share.Hackernews -}} + + {{- dict "Class" "fab fa-hacker-news fa-fw" | partial "plugin/icon.html" -}} + + {{- end -}} - {{- /* 009: Reddit */ -}} - {{- if $share.Reddit -}} - - {{- dict "Class" "fab fa-reddit fa-fw" | partial "plugin/icon.html" -}} - - {{- end -}} + {{- /* 009: Reddit */ -}} + {{- if $share.Reddit -}} + + {{- dict "Class" "fab fa-reddit fa-fw" | partial "plugin/icon.html" -}} + + {{- end -}} - {{- /* 010: VK */ -}} - {{- if $share.VK -}} - - {{- dict "Class" "fab fa-vk fa-fw" | partial "plugin/icon.html" -}} - - {{- end -}} + {{- /* 010: VK */ -}} + {{- if $share.VK -}} + + {{- dict "Class" "fab fa-vk fa-fw" | partial "plugin/icon.html" -}} + + {{- end -}} - {{- /* 011: Buffer */ -}} - {{- if $share.Buffer -}} - - {{- dict "Class" "fab fa-buffer fa-fw" | partial "plugin/icon.html" -}} - - {{- end -}} + {{- /* 011: Buffer */ -}} + {{- if $share.Buffer -}} + + {{- dict "Class" "fab fa-buffer fa-fw" | partial "plugin/icon.html" -}} + + {{- end -}} - {{- /* 012: Xing */ -}} - {{- if $share.Xing -}} - - {{- dict "Class" "fab fa-xing fa-fw" | partial "plugin/icon.html" -}} - - {{- end -}} + {{- /* 012: Xing */ -}} + {{- if $share.Xing -}} + + {{- dict "Class" "fab fa-xing fa-fw" | partial "plugin/icon.html" -}} + + {{- end -}} - {{- /* 013: Line */ -}} - {{- if $share.Line -}} - - {{- dict "Simpleicons" "line" "Prefix" (.Scratch.Get "cdn" | default dict).simpleIconsPrefix | partial "plugin/icon.html" -}} - - {{- end -}} + {{- /* 013: Line */ -}} + {{- if $share.Line -}} + + {{- dict "Simpleicons" "line" "Prefix" (.Scratch.Get "cdn" | default dict).simpleIconsPrefix | partial "plugin/icon.html" -}} + + {{- end -}} - {{- /* 014: Instapaper */ -}} - {{- if $share.Instapaper -}} - - {{- dict "Simpleicons" "instapaper" "Prefix" (.Scratch.Get "cdn" | default dict).simpleIconsPrefix | partial "plugin/icon.html" -}} - - {{- end -}} + {{- /* 014: Instapaper */ -}} + {{- if $share.Instapaper -}} + + {{- dict "Simpleicons" "instapaper" "Prefix" (.Scratch.Get "cdn" | default dict).simpleIconsPrefix | partial "plugin/icon.html" -}} + + {{- end -}} - {{- /* 015: Pocket */ -}} - {{- if $share.Pocket -}} - - {{- dict "Class" "fab fa-get-pocket fa-fw" | partial "plugin/icon.html" -}} - - {{- end -}} + {{- /* 015: Pocket */ -}} + {{- if $share.Pocket -}} + + {{- dict "Class" "fab fa-get-pocket fa-fw" | partial "plugin/icon.html" -}} + + {{- end -}} - {{- /* 016: Digg */ -}} - {{- if $share.Digg -}} - - {{- dict "Class" "fab fa-digg fa-fw" | partial "plugin/icon.html" -}} - - {{- end -}} + {{- /* 016: Digg */ -}} + {{- if $share.Digg -}} + + {{- dict "Class" "fab fa-digg fa-fw" | partial "plugin/icon.html" -}} + + {{- end -}} - {{- /* 017: StumbleUpon */ -}} - {{- if $share.Stumbleupon -}} - - {{- dict "Class" "fab fa-stumbleupon fa-fw" | partial "plugin/icon.html" -}} - - {{- end -}} + {{- /* 017: StumbleUpon */ -}} + {{- if $share.Stumbleupon -}} + + {{- dict "Class" "fab fa-stumbleupon fa-fw" | partial "plugin/icon.html" -}} + + {{- end -}} - {{- /* 018: Flipboard */ -}} - {{- if $share.Flipboard -}} - - {{- dict "Class" "fab fa-flipboard fa-fw" | partial "plugin/icon.html" -}} - - {{- end -}} + {{- /* 018: Flipboard */ -}} + {{- if $share.Flipboard -}} + + {{- dict "Class" "fab fa-flipboard fa-fw" | partial "plugin/icon.html" -}} + + {{- end -}} - {{- /* 019: 微博 */ -}} - {{- if $share.Weibo -}} - - {{- dict "Class" "fab fa-weibo fa-fw" | partial "plugin/icon.html" -}} - - {{- end -}} + {{- /* 019: 微博 */ -}} + {{- if $share.Weibo -}} + + {{- dict "Class" "fab fa-weibo fa-fw" | partial "plugin/icon.html" -}} + + {{- end -}} - {{- /* 020: 人人 */ -}} - {{- if $share.Renren -}} - - {{- dict "Class" "fab fa-renren fa-fw" | partial "plugin/icon.html" -}} - - {{- end -}} + {{- /* 020: 人人 */ -}} + {{- if $share.Renren -}} + + {{- dict "Class" "fab fa-renren fa-fw" | partial "plugin/icon.html" -}} + + {{- end -}} - {{- /* 021: Myspace */ -}} - {{- if $share.Myspace -}} - - {{- dict "Simpleicons" "myspace" "Prefix" (.Scratch.Get "cdn" | default dict).simpleIconsPrefix | partial "plugin/icon.html" -}} - - {{- end -}} + {{- /* 021: Myspace */ -}} + {{- if $share.Myspace -}} + + {{- dict "Simpleicons" "myspace" "Prefix" (.Scratch.Get "cdn" | default dict).simpleIconsPrefix | partial "plugin/icon.html" -}} + + {{- end -}} - {{- /* 022: Blogger */ -}} - {{- if $share.Blogger -}} - - {{- dict "Class" "fab fa-blogger fa-fw" | partial "plugin/icon.html" -}} - - {{- end -}} + {{- /* 022: Blogger */ -}} + {{- if $share.Blogger -}} + + {{- dict "Class" "fab fa-blogger fa-fw" | partial "plugin/icon.html" -}} + + {{- end -}} - {{- /* 023: 百度 */ -}} - {{- if $share.Baidu -}} - - {{- dict "Simpleicons" "baidu" "Prefix" (.Scratch.Get "cdn" | default dict).simpleIconsPrefix | partial "plugin/icon.html" -}} - - {{- end -}} + {{- /* 023: 百度 */ -}} + {{- if $share.Baidu -}} + + {{- dict "Simpleicons" "baidu" "Prefix" (.Scratch.Get "cdn" | default dict).simpleIconsPrefix | partial "plugin/icon.html" -}} + + {{- end -}} - {{- /* 024: OK.RU */ -}} - {{- if $share.Odnoklassniki -}} - - {{- dict "Class" "fab fa-odnoklassniki fa-fw" | partial "plugin/icon.html" -}} - - {{- end -}} + {{- /* 024: OK.RU */ -}} + {{- if $share.Odnoklassniki -}} + + {{- dict "Class" "fab fa-odnoklassniki fa-fw" | partial "plugin/icon.html" -}} + + {{- end -}} - {{- /* 025: Evernote */ -}} - {{- if $share.Evernote -}} - - {{- dict "Class" "fab fa-evernote fa-fw" | partial "plugin/icon.html" -}} - - {{- end -}} + {{- /* 025: Evernote */ -}} + {{- if $share.Evernote -}} + + {{- dict "Class" "fab fa-evernote fa-fw" | partial "plugin/icon.html" -}} + + {{- end -}} - {{- /* 026: Skype */ -}} - {{- if $share.Skype -}} - - {{- dict "Class" "fab fa-skype fa-fw" | partial "plugin/icon.html" -}} - - {{- end -}} + {{- /* 026: Skype */ -}} + {{- if $share.Skype -}} + + {{- dict "Class" "fab fa-skype fa-fw" | partial "plugin/icon.html" -}} + + {{- end -}} - {{- /* 027: Trello */ -}} - {{- if $share.Trello -}} - - {{- dict "Class" "fab fa-trello fa-fw" | partial "plugin/icon.html" -}} - - {{- end -}} + {{- /* 027: Trello */ -}} + {{- if $share.Trello -}} + + {{- dict "Class" "fab fa-trello fa-fw" | partial "plugin/icon.html" -}} + + {{- end -}} - {{- /* 028: Mix */ -}} - {{- if $share.Mix -}} - - {{- dict "Class" "fab fa-mix fa-fw" | partial "plugin/icon.html" -}} - - {{- end -}} + {{- /* 028: Mix */ -}} + {{- if $share.Mix -}} + + {{- dict "Class" "fab fa-mix fa-fw" | partial "plugin/icon.html" -}} + + {{- end -}} {{- end -}} diff --git a/layouts/partials/plugin/social.html b/layouts/partials/plugin/social.html index e6d20054..1d75597f 100644 --- a/layouts/partials/plugin/social.html +++ b/layouts/partials/plugin/social.html @@ -1,11 +1,11 @@ {{- $destination := "" -}} {{- with .Url -}} - {{- $destination = . | relLangURL -}} + {{- $destination = . | relLangURL -}} {{- else -}} - {{- $template := .Template | default "%v" -}} - {{- with .Prefix -}} - {{- $template = . | strings.TrimSuffix "/" | printf "%v/%%v" -}} - {{- end -}} - {{- $destination = printf (string $template) .Id -}} + {{- $template := .Template | default "%v" -}} + {{- with .Prefix -}} + {{- $template = . | strings.TrimSuffix "/" | printf "%v/%%v" -}} + {{- end -}} + {{- $destination = printf (string $template) .Id -}} {{- end -}} {{- dict "Destination" $destination "Rel" "me" | merge . | partial "plugin/link.html" -}} diff --git a/layouts/partials/plugin/style.html b/layouts/partials/plugin/style.html index 9c9c9895..103a1a0f 100644 --- a/layouts/partials/plugin/style.html +++ b/layouts/partials/plugin/style.html @@ -1,31 +1,31 @@ {{- if strings.HasPrefix .Source " + {{- with .Fingerprint -}} + {{- $resource = $resource | fingerprint . -}} + {{- $integrity = $resource.Data.Integrity -}} + {{- end -}} + {{- $href = $resource.RelPermalink -}} + {{- end -}} + {{- end -}} diff --git a/layouts/partials/rss/item.html b/layouts/partials/rss/item.html index ea08a6e0..0ee42a96 100644 --- a/layouts/partials/rss/item.html +++ b/layouts/partials/rss/item.html @@ -1,36 +1,36 @@ {{- $params := .Page.Params | merge .Site.Params.Page | merge (dict "author" .Site.Author.name) -}} - - {{- .Page.Title -}} - - - {{- .Page.Permalink -}} - - - {{- .Page.Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" -}} - - - {{- $params.author | default (T "author") -}} - - - {{- .Page.Permalink -}} - - - {{- " - -
- {{- end -}} - {{- $content := .Page.Description -}} - {{- if $params.rssFullText -}} - {{- $content = dict "Content" .Page.Content "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" -}} - {{- else -}} - {{- with .Page.Summary -}} - {{- $content = dict "Content" . "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" -}} - {{- end -}} - {{- end -}} - {{- $content | replaceRE `]*>.*` "" | replaceRE `]*( /)?>` "" | safeHTML -}} - {{- "]]>" | safeHTML -}} - + + {{- .Page.Title -}} + + + {{- .Page.Permalink -}} + + + {{- .Page.Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" -}} + + + {{- $params.author | default (T "author") -}} + + + {{- .Page.Permalink -}} + + + {{- " + + + {{- end -}} + {{- $content := .Page.Description -}} + {{- if $params.rssFullText -}} + {{- $content = dict "Content" .Page.Content "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" -}} + {{- else -}} + {{- with .Page.Summary -}} + {{- $content = dict "Content" . "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" -}} + {{- end -}} + {{- end -}} + {{- $content | replaceRE `]*>.*` "" | replaceRE `]*( /)?>` "" | safeHTML -}} + {{- "]]>" | safeHTML -}} + \ No newline at end of file diff --git a/layouts/partials/single/footer.html b/layouts/partials/single/footer.html index c5b682f4..16818828 100644 --- a/layouts/partials/single/footer.html +++ b/layouts/partials/single/footer.html @@ -1,72 +1,72 @@ {{- $params := .Scratch.Get "params" -}} + + -
- {{- if .PrevInSection -}} - + + {{- end -}} + +
+ {{ T "back" }} | {{ T "home" }} +
+
+ +
+ {{- if .PrevInSection -}} + + {{- end -}} + {{ if .NextInSection }} + + {{- end -}} +
diff --git a/layouts/posts/rss.xml b/layouts/posts/rss.xml index 454cdec4..884679a6 100644 --- a/layouts/posts/rss.xml +++ b/layouts/posts/rss.xml @@ -1,41 +1,41 @@ - - - {{- .Params.Title | default (T .Section) | default .Section | dict "Some" | T "allSome" }} - {{ .Site.Title -}} - - - {{- .Permalink -}} - - - {{- .Params.Title | default (T .Section) | default .Section | dict "Some" | T "allSome" }} | {{ .Site.Title -}} - - Hugo -- gohugo.io - {{- with .Site.LanguageCode -}} - - {{- . -}} - - {{- end -}} - {{- with .Site.Author.email -}} - - {{- . }}{{ with $.Site.Author.name }} ({{ . }}){{ end -}} - - - {{- . }}{{ with $.Site.Author.name }} ({{ . }}){{ end -}} - - {{- end -}} - {{- with .Site.Copyright -}} - - {{- . -}} - - {{- end -}} - {{- if not .Date.IsZero -}} - - {{- .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" -}} - - {{- end -}} - - {{- range .Pages | first (.Site.Params.section.rss | default 10) -}} - {{- dict "Page" . "Site" .Site | partial "rss/item.html" -}} - {{- end -}} - + + + {{- .Params.Title | default (T .Section) | default .Section | dict "Some" | T "allSome" }} - {{ .Site.Title -}} + + + {{- .Permalink -}} + + + {{- .Params.Title | default (T .Section) | default .Section | dict "Some" | T "allSome" }} | {{ .Site.Title -}} + + Hugo -- gohugo.io + {{- with .Site.LanguageCode -}} + + {{- . -}} + + {{- end -}} + {{- with .Site.Author.email -}} + + {{- . }}{{ with $.Site.Author.name }} ({{ . }}){{ end -}} + + + {{- . }}{{ with $.Site.Author.name }} ({{ . }}){{ end -}} + + {{- end -}} + {{- with .Site.Copyright -}} + + {{- . -}} + + {{- end -}} + {{- if not .Date.IsZero -}} + + {{- .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" -}} + + {{- end -}} + + {{- range .Pages | first (.Site.Params.section.rss | default 10) -}} + {{- dict "Page" . "Site" .Site | partial "rss/item.html" -}} + {{- end -}} + diff --git a/layouts/shortcodes/admonition.html b/layouts/shortcodes/admonition.html index bfe14526..175436ba 100644 --- a/layouts/shortcodes/admonition.html +++ b/layouts/shortcodes/admonition.html @@ -15,27 +15,27 @@ {{- $iconDetails := "fas fa-angle-right fa-fw" -}} {{- if .IsNamedParams -}} - {{- $type := .Get "type" | default "note" -}} -
-
- {{ .Get "title" | default (T $type) }} -
-
-
- {{- $inner -}} -
-
+ {{- $type := .Get "type" | default "note" -}} +
+
+ {{ .Get "title" | default (T $type) }}
+
+
+ {{- $inner -}} +
+
+
{{- else -}} - {{- $type := .Get 0 | default "note" -}} -
-
- {{ .Get 1 | default (T $type) }} -
-
-
- {{- $inner -}} -
-
+ {{- $type := .Get 0 | default "note" -}} +
+
+ {{ .Get 1 | default (T $type) }}
+
+
+ {{- $inner -}} +
+
+
{{- end -}} diff --git a/layouts/shortcodes/bilibili.html b/layouts/shortcodes/bilibili.html index c14cdc96..5f243abe 100644 --- a/layouts/shortcodes/bilibili.html +++ b/layouts/shortcodes/bilibili.html @@ -1,7 +1,7 @@
- {{- if .IsNamedParams -}} - - {{- else -}} - - {{- end -}} + {{- if .IsNamedParams -}} + + {{- else -}} + + {{- end -}}
diff --git a/layouts/shortcodes/cardlink.html b/layouts/shortcodes/cardlink.html index 96dc4327..bfd35186 100644 --- a/layouts/shortcodes/cardlink.html +++ b/layouts/shortcodes/cardlink.html @@ -1,15 +1,15 @@ {{- $destination := cond .IsNamedParams (.Get "href") (.Get 0) -}} {{- with dict "Path" $destination "Resources" .Page.Resources | partial "function/resource.html" -}} - {{- $destination = .RelPermalink -}} + {{- $destination = .RelPermalink -}} {{- end -}} {{- $options := dict "Destination" $destination -}} {{- if .IsNamedParams -}} - {{- $options = dict "Content" (.Get "content") | merge $options -}} - {{- $options = dict "Title" (.Get "title") | merge $options -}} - {{- $options = dict "Class" (.Get "class") | merge $options -}} - {{- $options = dict "Rel" (.Get "rel") | merge $options -}} + {{- $options = dict "Content" (.Get "content") | merge $options -}} + {{- $options = dict "Title" (.Get "title") | merge $options -}} + {{- $options = dict "Class" (.Get "class") | merge $options -}} + {{- $options = dict "Rel" (.Get "rel") | merge $options -}} {{- else -}} - {{- $options = dict "Content" (.Get 1 | default (.Get 0)) | merge $options -}} - {{- $options = dict "Title" (.Get 2) | merge $options -}} + {{- $options = dict "Content" (.Get 1 | default (.Get 0)) | merge $options -}} + {{- $options = dict "Title" (.Get 2) | merge $options -}} {{- end -}} {{- partial "plugin/cardlink.html" $options -}} diff --git a/layouts/shortcodes/image.html b/layouts/shortcodes/image.html index 4bb365af..c35d13b2 100644 --- a/layouts/shortcodes/image.html +++ b/layouts/shortcodes/image.html @@ -4,26 +4,26 @@ {{- $options = dict "Caption" $caption | merge $options -}} {{- if .IsNamedParams -}} - {{- $options = dict "Title" (.Get "title") | merge $options -}} - {{- $options = dict "SrcSmall" (.Get "src_s") | merge $options -}} - {{- $options = dict "SrcLarge" (.Get "src_l") | merge $options -}} - {{- $options = dict "Height" (.Get "height") | merge $options -}} - {{- $options = dict "Width" (.Get "width") | merge $options -}} - {{- $options = .Get "linked" | ne false | dict "Linked" | merge $options -}} - {{- $options = dict "Rel" (.Get "rel") | merge $options -}} + {{- $options = dict "Title" (.Get "title") | merge $options -}} + {{- $options = dict "SrcSmall" (.Get "src_s") | merge $options -}} + {{- $options = dict "SrcLarge" (.Get "src_l") | merge $options -}} + {{- $options = dict "Height" (.Get "height") | merge $options -}} + {{- $options = dict "Width" (.Get "width") | merge $options -}} + {{- $options = .Get "linked" | ne false | dict "Linked" | merge $options -}} + {{- $options = dict "Rel" (.Get "rel") | merge $options -}} {{- else -}} - {{- $options = cond $caption true false | dict "Linked" | merge $options -}} + {{- $options = cond $caption true false | dict "Linked" | merge $options -}} {{- end -}} {{- $options = dict "Resources" .Page.Resources | merge $options -}} {{- with $caption -}} - - {{- partial "plugin/image.html" $options -}} -
- {{- . | safeHTML -}} -
- -{{- else -}} + {{- partial "plugin/image.html" $options -}} +
+ {{- . | safeHTML -}} +
+ +{{- else -}} + {{- partial "plugin/image.html" $options -}} {{- end -}} diff --git a/layouts/shortcodes/link.html b/layouts/shortcodes/link.html index cac09e93..5b201f2c 100644 --- a/layouts/shortcodes/link.html +++ b/layouts/shortcodes/link.html @@ -1,15 +1,15 @@ {{- $destination := cond .IsNamedParams (.Get "href") (.Get 0) -}} {{- with dict "Path" $destination "Resources" .Page.Resources | partial "function/resource.html" -}} - {{- $destination = .RelPermalink -}} + {{- $destination = .RelPermalink -}} {{- end -}} {{- $options := dict "Destination" $destination -}} {{- if .IsNamedParams -}} - {{- $options = dict "Content" (.Get "content") | merge $options -}} - {{- $options = dict "Title" (.Get "title") | merge $options -}} - {{- $options = dict "Class" (.Get "class") | merge $options -}} - {{- $options = dict "Rel" (.Get "rel") | merge $options -}} + {{- $options = dict "Content" (.Get "content") | merge $options -}} + {{- $options = dict "Title" (.Get "title") | merge $options -}} + {{- $options = dict "Class" (.Get "class") | merge $options -}} + {{- $options = dict "Rel" (.Get "rel") | merge $options -}} {{- else -}} - {{- $options = dict "Content" (.Get 1 | default (.Get 0)) | merge $options -}} - {{- $options = dict "Title" (.Get 2) | merge $options -}} + {{- $options = dict "Content" (.Get 1 | default (.Get 0)) | merge $options -}} + {{- $options = dict "Title" (.Get 2) | merge $options -}} {{- end -}} {{- partial "plugin/link.html" $options -}} diff --git a/layouts/shortcodes/mapbox.html b/layouts/shortcodes/mapbox.html index 516d3703..3167162d 100644 --- a/layouts/shortcodes/mapbox.html +++ b/layouts/shortcodes/mapbox.html @@ -14,17 +14,17 @@ {{- $height := "20rem" -}} {{- if .IsNamedParams -}} - {{- $lightStyle = .Get "light-style" | default $lightStyle -}} - {{- $darkStyle = .Get "dark-style" | default $darkStyle -}} - {{- $navigation = .Get "navigation" | ne false | and $navigation -}} - {{- $geolocate = .Get "geolocate" | ne false | and $geolocate -}} - {{- $scale = .Get "scale" | ne false | and $scale -}} - {{- $fullscreen = .Get "fullscreen" | ne false | and $fullscreen -}} - {{- $width = .Get "width" | default $width -}} - {{- $height = .Get "height" | default $height -}} + {{- $lightStyle = .Get "light-style" | default $lightStyle -}} + {{- $darkStyle = .Get "dark-style" | default $darkStyle -}} + {{- $navigation = .Get "navigation" | ne false | and $navigation -}} + {{- $geolocate = .Get "geolocate" | ne false | and $geolocate -}} + {{- $scale = .Get "scale" | ne false | and $scale -}} + {{- $fullscreen = .Get "fullscreen" | ne false | and $fullscreen -}} + {{- $width = .Get "width" | default $width -}} + {{- $height = .Get "height" | default $height -}} {{- else -}} - {{- $lightStyle = .Get 4 | default $lightStyle -}} - {{- $darkStyle = .Get 5 | default $darkStyle -}} + {{- $lightStyle = .Get 4 | default $lightStyle -}} + {{- $darkStyle = .Get 5 | default $darkStyle -}} {{- end -}} {{- $darkStyle = $darkStyle | default $lightStyle -}} {{- $options := dict "lng" $lng "lat" $lat "zoom" $zoom "marked" $marked "lightStyle" $lightStyle "darkStyle" $darkStyle "geolocate" $geolocate "navigation" $navigation "scale" $scale "fullscreen" $fullscreen -}} diff --git a/layouts/shortcodes/music.html b/layouts/shortcodes/music.html index 904ad5b3..2c3ec031 100644 --- a/layouts/shortcodes/music.html +++ b/layouts/shortcodes/music.html @@ -1,50 +1,50 @@ {{- $theme := "#448aff" -}} {{- if .IsNamedParams -}} - {{- $theme = .Get "theme" | default $theme -}} - {{- if .Get "url" -}} - {{- $url := .Get "url" -}} - {{- with dict "Path" $url "Resources" .Page.Resources | partial "function/resource.html" -}} - {{- $url = .RelPermalink -}} - {{- end -}} - {{- $cover := .Get "cover" -}} - {{- with dict "Path" $cover "Resources" .Page.Resources | partial "function/resource.html" -}} - {{- $cover = .RelPermalink -}} - {{- end -}} - - {{- else if .Get "auto" -}} - - {{- else -}} - + {{- $theme = .Get "theme" | default $theme -}} + {{- if .Get "url" -}} + {{- $url := .Get "url" -}} + {{- with dict "Path" $url "Resources" .Page.Resources | partial "function/resource.html" -}} + {{- $url = .RelPermalink -}} {{- end -}} + {{- $cover := .Get "cover" -}} + {{- with dict "Path" $cover "Resources" .Page.Resources | partial "function/resource.html" -}} + {{- $cover = .RelPermalink -}} + {{- end -}} + + {{- else if .Get "auto" -}} + + {{- else -}} + + {{- end -}} {{- else if (.Get 0 | urls.Parse).Host -}} - + {{- else -}} - + {{- end -}} {{- .Page.Scratch.SetInMap "this" "music" true -}} diff --git a/layouts/shortcodes/typeit.html b/layouts/shortcodes/typeit.html index 1d2ea012..8269f7f0 100644 --- a/layouts/shortcodes/typeit.html +++ b/layouts/shortcodes/typeit.html @@ -3,19 +3,19 @@ {{- $tag := .Get "tag" | default "div" -}} {{- with .Get "code" -}} - {{- /* highlight code content without line number */ -}} - {{- $content = highlight $content . "linenos=false" -}} - {{- /* delete outer label */ -}} - {{- $content = replaceRE `
]*>(?s)(.*)
` "$1" $content -}} - {{- /* parsing markdown links */ -}} - {{- $content = replaceRE `(]*>)([^<>]*)\[([^<>]+)\]\(([^<>]+)\)([^<>]*)()` "$1$2$6$3$1$5$6" $content -}} - {{- /* replace " " to " " and replace "\n" to "
" */ -}} - {{- $content = replaceRE ` ` " " $content | replaceRE `(<\w+) ` "$1 " | replaceRE `\n` "
" -}} - {{- /* fix "
" location error which is a bug of Typeit HTML parser */ -}} - {{- $content = replaceRE `
` "
" $content -}} - {{- $classList = $classList | append "highlight" -}} + {{- /* highlight code content without line number */ -}} + {{- $content = highlight $content . "linenos=false" -}} + {{- /* delete outer label */ -}} + {{- $content = replaceRE `
]*>(?s)(.*)
` "$1" $content -}} + {{- /* parsing markdown links */ -}} + {{- $content = replaceRE `(]*>)([^<>]*)\[([^<>]+)\]\(([^<>]+)\)([^<>]*)()` "$1$2$6$3$1$5$6" $content -}} + {{- /* replace " " to " " and replace "\n" to "
" */ -}} + {{- $content = replaceRE ` ` " " $content | replaceRE `(<\w+) ` "$1 " | replaceRE `\n` "
" -}} + {{- /* fix "
" location error which is a bug of Typeit HTML parser */ -}} + {{- $content = replaceRE `
` "
" $content -}} + {{- $classList = $classList | append "highlight" -}} {{- else -}} - {{- $content = $content | .Page.RenderString -}} + {{- $content = $content | .Page.RenderString -}} {{- end -}} {{- /* trim the newline */ -}} @@ -27,5 +27,5 @@ {{- dict $key $group | merge $typeitMap | .Page.Scratch.SetInMap "this" "typeitMap" -}}
- {{- printf `<%v id="%v" class="%v">` $tag $id (delimit $classList " ") $tag | safeHTML -}} + {{- printf `<%v id="%v" class="%v">` $tag $id (delimit $classList " ") $tag | safeHTML -}}
diff --git a/layouts/shortcodes/version.html b/layouts/shortcodes/version.html index d6cfc2e9..d11e84f7 100644 --- a/layouts/shortcodes/version.html +++ b/layouts/shortcodes/version.html @@ -9,5 +9,5 @@ {{- $resource = $resource | resources.ExecuteAsTemplate $path (dict "version" $version "label" $label "color" $color) | minify -}} {{- $alt := printf "FixIt %v | %v" $label $version -}} - {{- dict "Src" $resource.RelPermalink "Alt" $alt "Class" "version" | partial "plugin/image.html" -}} + {{- dict "Src" $resource.RelPermalink "Alt" $alt "Class" "version" | partial "plugin/image.html" -}} \ No newline at end of file diff --git a/layouts/sitemap.xml b/layouts/sitemap.xml index f931c442..85a020cd 100644 --- a/layouts/sitemap.xml +++ b/layouts/sitemap.xml @@ -1,47 +1,47 @@ - {{- range (where .Data.Pages "Section" "!=" "gallery") -}} - - - {{- .Permalink -}} - - {{- if not .Lastmod.IsZero -}} - - {{- .Lastmod.Format "2006-01-02T15:04:05-07:00" -}} - - {{- end -}} - {{- with .Sitemap.ChangeFreq -}} - - {{- . -}} - - {{- end -}} + xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" + xmlns:xhtml="http://www.w3.org/1999/xhtml" + > + {{- range (where .Data.Pages "Section" "!=" "gallery") -}} + + + {{- .Permalink -}} + + {{- if not .Lastmod.IsZero -}} + + {{- .Lastmod.Format "2006-01-02T15:04:05-07:00" -}} + + {{- end -}} + {{- with .Sitemap.ChangeFreq -}} + + {{- . -}} + + {{- end -}} - {{- if ge .Sitemap.Priority 0.0 -}} - {{- $weeks := div (sub now.Unix .Lastmod.Unix) 604800 -}} - {{- $priority := sub 1 (div $weeks 10.0 ) -}} - {{- if ge .Sitemap.Priority $priority -}} - {{ .Sitemap.Priority }} - {{- else -}} - {{ $priority }} - {{- end -}} - {{- end -}} + {{- if ge .Sitemap.Priority 0.0 -}} + {{- $weeks := div (sub now.Unix .Lastmod.Unix) 604800 -}} + {{- $priority := sub 1 (div $weeks 10.0 ) -}} + {{- if ge .Sitemap.Priority $priority -}} + {{ .Sitemap.Priority }} + {{- else -}} + {{ $priority }} + {{- end -}} + {{- end -}} - {{- if .IsTranslated -}} - {{- range .Translations -}} - - {{- end -}} - - {{- end -}} - - {{- end -}} + {{- if .IsTranslated -}} + {{- range .Translations -}} + + {{- end -}} + + {{- end -}} + + {{- end -}} diff --git a/layouts/taxonomy/list.html b/layouts/taxonomy/list.html index b3328485..c2e6141c 100644 --- a/layouts/taxonomy/list.html +++ b/layouts/taxonomy/list.html @@ -1,43 +1,43 @@ {{- define "title" -}} - {{- .Title }} - {{ T .Data.Singular | default .Data.Singular }} - {{ .Site.Title -}} + {{- .Title }} - {{ T .Data.Singular | default .Data.Singular }} - {{ .Site.Title -}} {{- end -}} {{- define "content" -}} -
- {{- /* Title */ -}} -

- {{- $taxonomy := .Data.Singular -}} - {{- if eq $taxonomy "category" -}} -  {{ .Title }} - {{- else if eq $taxonomy "tag" -}} -  {{ .Title }} - {{- else -}} - {{- printf "%v - %v" (T $taxonomy | default $taxonomy) .Title -}} - {{- end -}} -

+
+ {{- /* Title */ -}} +

+ {{- $taxonomy := .Data.Singular -}} + {{- if eq $taxonomy "category" -}} +  {{ .Title }} + {{- else if eq $taxonomy "tag" -}} +  {{ .Title }} + {{- else -}} + {{- printf "%v - %v" (T $taxonomy | default $taxonomy) .Title -}} + {{- end -}} +

- {{- /* Paginate */ -}} - {{- if .Pages -}} - {{- $pages := .Pages.GroupByDate "2006" -}} - {{- with .Site.Params.list.paginate | default .Site.Params.paginate -}} - {{- $pages = $.Paginate $pages . -}} - {{- else -}} - {{- $pages = .Paginate $pages -}} - {{- end -}} - {{- range $pages.PageGroups -}} -

{{ .Key }}

- {{- range .Pages -}} -
- - {{- .Title -}} - - - {{- $.Site.Params.list.dateFormat | default "01-02" | .Date.Format -}} - -
- {{- end -}} - {{- end -}} - {{- partial "paginator.html" . -}} + {{- /* Paginate */ -}} + {{- if .Pages -}} + {{- $pages := .Pages.GroupByDate "2006" -}} + {{- with .Site.Params.list.paginate | default .Site.Params.paginate -}} + {{- $pages = $.Paginate $pages . -}} + {{- else -}} + {{- $pages = .Paginate $pages -}} + {{- end -}} + {{- range $pages.PageGroups -}} +

{{ .Key }}

+ {{- range .Pages -}} +
+ + {{- .Title -}} + + + {{- $.Site.Params.list.dateFormat | default "01-02" | .Date.Format -}} + +
{{- end -}} -
+ {{- end -}} + {{- partial "paginator.html" . -}} + {{- end -}} +
{{- end -}} diff --git a/layouts/taxonomy/rss.xml b/layouts/taxonomy/rss.xml index a597e569..50a1e884 100644 --- a/layouts/taxonomy/rss.xml +++ b/layouts/taxonomy/rss.xml @@ -1,41 +1,41 @@ - - - {{- .Title }} - {{ T .Data.Singular | default .Data.Singular }} - {{ .Site.Title -}} - - - {{- .Permalink -}} - - - {{- .Title }} - {{ T .Data.Singular | default .Data.Singular }} - {{ .Site.Title -}} - - Hugo -- gohugo.io - {{- with .Site.LanguageCode -}} - - {{- . -}} - - {{- end -}} - {{- with .Site.Author.email -}} - - {{- . }}{{ with $.Site.Author.name }} ({{ . }}){{ end -}} - - - {{- . }}{{ with $.Site.Author.name }} ({{ . }}){{ end -}} - - {{- end -}} - {{- with .Site.Copyright -}} - - {{- . -}} - - {{- end -}} - {{- if not .Date.IsZero -}} - - {{- .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" -}} - - {{- end -}} - - {{- range .Pages | first (.Site.Params.list.rss | default 10) -}} - {{- dict "Page" . "Site" .Site | partial "rss/item.html" -}} - {{- end -}} - + + + {{- .Title }} - {{ T .Data.Singular | default .Data.Singular }} - {{ .Site.Title -}} + + + {{- .Permalink -}} + + + {{- .Title }} - {{ T .Data.Singular | default .Data.Singular }} - {{ .Site.Title -}} + + Hugo -- gohugo.io + {{- with .Site.LanguageCode -}} + + {{- . -}} + + {{- end -}} + {{- with .Site.Author.email -}} + + {{- . }}{{ with $.Site.Author.name }} ({{ . }}){{ end -}} + + + {{- . }}{{ with $.Site.Author.name }} ({{ . }}){{ end -}} + + {{- end -}} + {{- with .Site.Copyright -}} + + {{- . -}} + + {{- end -}} + {{- if not .Date.IsZero -}} + + {{- .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" -}} + + {{- end -}} + + {{- range .Pages | first (.Site.Params.list.rss | default 10) -}} + {{- dict "Page" . "Site" .Site | partial "rss/item.html" -}} + {{- end -}} + diff --git a/layouts/taxonomy/terms.html b/layouts/taxonomy/terms.html index 077f8bfa..3064b1fb 100644 --- a/layouts/taxonomy/terms.html +++ b/layouts/taxonomy/terms.html @@ -1,57 +1,57 @@ {{- define "title" -}} - {{- .Params.Title | default (T .Data.Plural) | default .Data.Plural | dict "Some" | T "allSome" }} - {{ .Site.Title -}} + {{- .Params.Title | default (T .Data.Plural) | default .Data.Plural | dict "Some" | T "allSome" }} - {{ .Site.Title -}} {{- end -}} {{- define "content" -}} - {{- $taxonomies := .Data.Plural -}} - {{- $terms := .Data.Terms.ByCount -}} - {{- $type := .Type -}} + {{- $taxonomies := .Data.Plural -}} + {{- $terms := .Data.Terms.ByCount -}} + {{- $type := .Type -}} -
- {{- /* Title */ -}} -

- {{- .Params.Title | default (T $taxonomies) | default $taxonomies | dict "Some" | T "allSome" -}} -

+
+ {{- /* Title */ -}} +

+ {{- .Params.Title | default (T $taxonomies) | default $taxonomies | dict "Some" | T "allSome" -}} +

- {{- /* Categories Page */ -}} - {{- if eq $taxonomies "categories" -}} -
- {{- range $terms -}} - {{- $term := .Term -}} - {{- $pages := .Pages -}} - {{- with $.Site.GetPage "taxonomy" (printf "%v/%v" $type $term) -}} -
-
-

- -  {{ .Page.Title }} - -

- {{- range first 5 $pages -}} - - {{- end -}} - {{- if gt (len $pages) 5 -}} - - {{ T "more" }} >> - - {{- end -}} -
-
- {{- end -}} - {{- end -}} -
- - {{- /* Tag Cloud Page */ -}} - {{- else if eq $taxonomies "tags" -}} -
- {{- range $.Site.Taxonomies.tags.ByCount -}} - {{ .Page.Title }} {{ .Count }} - {{- end -}} + {{- /* Categories Page */ -}} + {{- if eq $taxonomies "categories" -}} +
+ {{- range $terms -}} + {{- $term := .Term -}} + {{- $pages := .Pages -}} + {{- with $.Site.GetPage "taxonomy" (printf "%v/%v" $type $term) -}} +
+
+

+ +  {{ .Page.Title }} + +

+ {{- range first 5 $pages -}} + + {{- end -}} + {{- if gt (len $pages) 5 -}} + + {{ T "more" }} >> + + {{- end -}}
+
+ {{- end -}} {{- end -}} -
+
+ + {{- /* Tag Cloud Page */ -}} + {{- else if eq $taxonomies "tags" -}} +
+ {{- range $.Site.Taxonomies.tags.ByCount -}} + {{ .Page.Title }} {{ .Count }} + {{- end -}} +
+ {{- end -}} +
{{- end -}}