+
+
{{- $image := $.Params.featured_image_preview | default . -}}
- {{- partial "image" $image -}}
+ {{- partial "hook/image" $image -}}
{{- end -}}
{{- /* Title */ -}}
-
+
{{ .Title }}
{{- /* Meta */ -}}
-
+
{{- $author := .Params.author | default .Site.Author.name -}}
{{- $author_link := .Params.author_link | default .Site.Author.link | default .Site.BaseURL -}}
@@ -38,7 +38,7 @@
{{- /* Summary content */ -}}
-
+
{{- if .Params.description_as_summary -}}
{{- .Params.description -}}
diff --git a/layouts/index.html b/layouts/index.html
index 16580ea..6a60916 100644
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -1,7 +1,7 @@
{{- define "content" -}}
- {{- /* Home mode [post] */ -}}
- {{- if eq .Site.Params.home_mode "post" -}}
-
+
+ {{- /* Home mode [post] */ -}}
+ {{- if eq .Site.Params.home_mode "post" -}}
{{- /* Profile */ -}}
{{- partial "home/profile.html" . -}}
@@ -17,11 +17,11 @@
{{- .Render "summary" -}}
{{- end -}}
{{- partial "paginator.html" . -}}
-
- {{- /* Home mode [other] */ -}}
- {{- else -}}
- {{- /* Profile */ -}}
- {{- partial "home/profile.html" . -}}
- {{- end -}}
+ {{- /* Home mode [other] */ -}}
+ {{- else -}}
+ {{- /* Profile */ -}}
+ {{- partial "home/profile.html" . -}}
+ {{- end -}}
+
{{- end -}}
diff --git a/layouts/partials/comment.html b/layouts/partials/comment.html
new file mode 100644
index 0000000..ff41275
--- /dev/null
+++ b/layouts/partials/comment.html
@@ -0,0 +1,110 @@
+{{- if .Scratch.Get "production" | and .IsPage | and (ne .Params.comment false) -}}
+ {{- $CDN := .Scratch.Get "CDN" -}}
+
+ {{- /* Disqus Comment System */ -}}
+ {{- with .Site.Params.disqus.shortname -}}
+
+ {{- $script := printf `` . -}}
+ {{- slice $script | $.Scratch.Add "scriptCDN" -}}
+
+ {{- end -}}
+
+ {{- /* Gitalk Comment System */ -}}
+ {{- if .Site.Params.gitalk.owner -}}
+
+ {{- with $CDN.gitalk_css -}}
+ {{- slice . | $.Scratch.Add "linkCDN" -}}
+ {{- else -}}
+ {{- slice "css/lib/gitalk/gitalk.css" | .Scratch.Add "linkLocal" -}}
+ {{- end -}}
+ {{- with $CDN.gitalk_js -}}
+ {{- slice . | $.Scratch.Add "scriptCDN" -}}
+ {{- else -}}
+ {{- slice "css/lib/gitalk/gitalk.min.js" | .Scratch.Add "scriptLocal" -}}
+ {{- end -}}
+
+
+ {{- end -}}
+
+ {{- /* Valine Comment System */ -}}
+ {{- if .Site.Params.valine.enable -}}
+
+ {{- with $CDN.valine_js -}}
+ {{- slice . | $.Scratch.Add "scriptCDN" -}}
+ {{- else -}}
+ {{- slice "js/lib/valine/Valine.min.js" | .Scratch.Add "scriptLocal" -}}
+ {{- end -}}
+
+
+ {{- end -}}
+
+ {{- /* Facebook Comment System */ -}}
+ {{- if .Site.Params.facebook.enable -}}
+
+
+ {{- $script := `` -}}
+ {{- $script = printf $script .Site.Params.facebook.languageCode .Site.Params.facebook.appId -}}
+ {{- slice $script | .Scratch.Add "scriptCDN" -}}
+
+ {{- end -}}
+{{- end -}}
diff --git a/layouts/partials/comments.html b/layouts/partials/comments.html
deleted file mode 100644
index 1645d41..0000000
--- a/layouts/partials/comments.html
+++ /dev/null
@@ -1,101 +0,0 @@
-{{- if eq (getenv "HUGO_ENV") "production" | and .IsPage | and (ne .Params.comment false) -}}
- {{- /* Disqus Comment System */ -}}
- {{- with .Site.Params.disqus.shortname -}}
-
-
-
- {{- end -}}
-
- {{- /* Gitalk Comment System */ -}}
- {{- if .Site.Params.gitalk.owner -}}
-
- {{- if .Site.Params.cdn.gitalk_css -}}
- {{- .Site.Params.cdn.gitalk_css | safeHTML -}}
- {{- else -}}
- {{- $res := resources.Get "css/lib/gitalk/gitalk.css" | resources.Minify -}}
-
- {{- end -}}
- {{- if .Site.Params.cdn.gitalk_js -}}
- {{ .Site.Params.cdn.gitalk_js | safeHTML -}}
- {{- else -}}
- {{- $res := resources.Get "js/lib/gitalk/gitalk.min.js" | resources.Minify -}}
-
- {{- end -}}
-
-
- {{- end -}}
-
- {{- /* Valine Comment System */ -}}
- {{- if .Site.Params.valine.enable -}}
-
- {{- if .Site.Params.cdn.valine_js -}}
- {{- .Site.Params.cdn.valine_js | safeHTML -}}
- {{- else -}}
- {{- $res := resources.Get "js/lib/valine/Valine.min.js" | resources.Minify -}}
-
- {{- end -}}
-
-
- {{- end -}}
-
- {{- /* Facebook Comment System */ -}}
- {{- if .Site.Params.facebook.enable -}}
-
-
-
-
- {{- end -}}
-{{- end -}}
diff --git a/layouts/partials/head.html b/layouts/partials/head.html
deleted file mode 100644
index ff07135..0000000
--- a/layouts/partials/head.html
+++ /dev/null
@@ -1,77 +0,0 @@
-
-
-
-{{- with .Site.Params.google_verification -}}
-
-{{- end -}}
-{{- with .Site.Params.bing_verification -}}
-
-{{- end -}}
-{{- with .Site.Params.yandex_verification -}}
-
-{{- end -}}
-{{- with .Site.Params.pinterest_verification -}}
-
-{{- end -}}
-{{- with .Site.Params.baidu_verification -}}
-
-{{- end -}}
-{{- if .PrevInSection -}}
-
-{{- end -}}
-{{- if .NextInSection -}}
-
-{{- end -}}
-
-
-
-
-
-
-
-
-
-{{- with .OutputFormats.Get "RSS" -}}
-
-
-{{- end -}}
-
-{{- template "_internal/opengraph.html" . -}}
-
-{{- $share := .Params.share.enable | default .Site.Params.share.enable | eq true -}}
-{{- if $share | and (.Params.Share.Twitter | default .Site.Params.Share.Twitter | eq true) -}}
- {{- template "_internal/twitter_cards.html" . -}}
-{{- end -}}
-
-{{- partial "seo.html" . -}}
-
-{{- $options := dict "targetPath" "css/style.min.css" "outputStyle" "compressed" "enableSourceMap" true -}}
-{{- if fileExists "config/css/_custom.scss" -}}
- {{- $options = dict "includePaths" (slice "config/css") | merge $options -}}
- {{- $res := resources.Get "css/custom-style.scss" | toCSS $options -}}
-
-{{- else -}}
- {{- $res := resources.Get "css/style.scss" | toCSS $options -}}
-
-{{- end -}}
-
-{{- /* Font Awesome https://fontawesome.com/ */ -}}
-{{- if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.fontawesome_free_css -}}
- {{- .Site.Params.cdn.fontawesome_free_css | safeHTML -}}
-{{- else -}}
- {{- $res := resources.Get "css/lib/fontawesome-free/all.min.css" -}}
-
-{{- end -}}
-
-{{- /* Fork Awesome https://forkaweso.me/ */ -}}
-{{- $options := dict "targetPath" "css/lib/forkawesome/forkawesome.min.css" "outputStyle" "compressed" "enableSourceMap" true -}}
-{{- $res := resources.Get "css/lib/forkawesome/fork-awesome.scss"| toCSS $options -}}
-
-
-{{- /* Animate.css https://github.com/daneden/animate.css */ -}}
-{{- if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.animate_css -}}
- {{- .Site.Params.cdn.animate_css | safeHTML -}}
-{{- else -}}
- {{ $res := resources.Get "css/lib/animate/animate.min.css" -}}
-
-{{- end -}}
diff --git a/layouts/partials/head/link.html b/layouts/partials/head/link.html
new file mode 100644
index 0000000..92c6470
--- /dev/null
+++ b/layouts/partials/head/link.html
@@ -0,0 +1,51 @@
+{{- $CDN := .Scratch.Get "CDN" -}}
+
+
+
+
+
+
+
+
+
+{{- if .PrevInSection -}}
+
+{{- end -}}
+{{- if .NextInSection -}}
+
+{{- end -}}
+
+{{- with .OutputFormats.Get "RSS" -}}
+
+
+{{- end -}}
+
+{{- /* style.min.css */ -}}
+{{- $res := resources.Get "css/style.template.scss" -}}
+{{- $options := dict "targetPath" "css/style.min.css" "outputStyle" "compressed" "enableSourceMap" true -}}
+{{- if fileExists "config/css/_custom.scss" -}}
+ {{- $options = dict "includePaths" (slice "config/css") | merge $options -}}
+{{- end -}}
+{{- $res = resources.ExecuteAsTemplate "style.scss" . $res | toCSS $options -}}
+
+
+{{- /* Font Awesome https://fontawesome.com/ */ -}}
+{{- with $CDN.fontawesome_free_css -}}
+ {{- . | safeHTML -}}
+{{- else -}}
+ {{- $res := resources.Get "css/lib/fontawesome-free/all.min.css" -}}
+
+{{- end -}}
+
+{{- /* Fork Awesome https://forkaweso.me/ */ -}}
+{{- $options := dict "targetPath" "css/lib/forkawesome/fork-awesome.min.css" "outputStyle" "compressed" "enableSourceMap" true -}}
+{{- $res := resources.Get "css/lib/forkawesome/fork-awesome.scss"| toCSS $options -}}
+
+
+{{- /* Animate.css https://github.com/daneden/animate.css */ -}}
+{{- with $CDN.animate_css -}}
+ {{- . | safeHTML -}}
+{{- else -}}
+ {{ $res := resources.Get "css/lib/animate/animate.min.css" -}}
+
+{{- end -}}
diff --git a/layouts/partials/head/meta.html b/layouts/partials/head/meta.html
new file mode 100644
index 0000000..b41baeb
--- /dev/null
+++ b/layouts/partials/head/meta.html
@@ -0,0 +1,21 @@
+{{- with .Site.Params.google_verification -}}
+
+{{- end -}}
+{{- with .Site.Params.bing_verification -}}
+
+{{- end -}}
+{{- with .Site.Params.yandex_verification -}}
+
+{{- end -}}
+{{- with .Site.Params.pinterest_verification -}}
+
+{{- end -}}
+{{- with .Site.Params.baidu_verification -}}
+
+{{- end -}}
+
+{{- template "_internal/opengraph.html" . -}}
+{{- template "_internal/twitter_cards.html" . -}}
+
+
+
diff --git a/layouts/partials/seo.html b/layouts/partials/head/seo.html
similarity index 100%
rename from layouts/partials/seo.html
rename to layouts/partials/head/seo.html
diff --git a/layouts/partials/header.html b/layouts/partials/header.html
index 413e3e0..889fe85 100644
--- a/layouts/partials/header.html
+++ b/layouts/partials/header.html
@@ -1,12 +1,12 @@
-{{- /* Desktop navbar */ -}}
-
{{- $author := .Params.author | default .Site.Author.name -}}
{{- $author_link := .Params.author_link | default .Site.Author.link | default .Site.BaseURL -}}
@@ -38,7 +38,7 @@
{{- /* Summary content */ -}}
-
+
{{- if .Params.description_as_summary -}}
{{- .Params.description -}} diff --git a/layouts/index.html b/layouts/index.html index 16580ea..6a60916 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -1,7 +1,7 @@ {{- define "content" -}} - {{- /* Home mode [post] */ -}} - {{- if eq .Site.Params.home_mode "post" -}} -
+
{{- end -}}
diff --git a/layouts/partials/comment.html b/layouts/partials/comment.html
new file mode 100644
index 0000000..ff41275
--- /dev/null
+++ b/layouts/partials/comment.html
@@ -0,0 +1,110 @@
+{{- if .Scratch.Get "production" | and .IsPage | and (ne .Params.comment false) -}}
+ {{- $CDN := .Scratch.Get "CDN" -}}
+
+ {{- /* Disqus Comment System */ -}}
+ {{- with .Site.Params.disqus.shortname -}}
+
+ {{- $script := printf `` . -}}
+ {{- slice $script | $.Scratch.Add "scriptCDN" -}}
+
+ {{- end -}}
+
+ {{- /* Gitalk Comment System */ -}}
+ {{- if .Site.Params.gitalk.owner -}}
+
+ {{- with $CDN.gitalk_css -}}
+ {{- slice . | $.Scratch.Add "linkCDN" -}}
+ {{- else -}}
+ {{- slice "css/lib/gitalk/gitalk.css" | .Scratch.Add "linkLocal" -}}
+ {{- end -}}
+ {{- with $CDN.gitalk_js -}}
+ {{- slice . | $.Scratch.Add "scriptCDN" -}}
+ {{- else -}}
+ {{- slice "css/lib/gitalk/gitalk.min.js" | .Scratch.Add "scriptLocal" -}}
+ {{- end -}}
+
+
+ {{- end -}}
+
+ {{- /* Valine Comment System */ -}}
+ {{- if .Site.Params.valine.enable -}}
+
+ {{- with $CDN.valine_js -}}
+ {{- slice . | $.Scratch.Add "scriptCDN" -}}
+ {{- else -}}
+ {{- slice "js/lib/valine/Valine.min.js" | .Scratch.Add "scriptLocal" -}}
+ {{- end -}}
+
+
+ {{- end -}}
+
+ {{- /* Facebook Comment System */ -}}
+ {{- if .Site.Params.facebook.enable -}}
+
+
+ {{- $script := `` -}}
+ {{- $script = printf $script .Site.Params.facebook.languageCode .Site.Params.facebook.appId -}}
+ {{- slice $script | .Scratch.Add "scriptCDN" -}}
+
+ {{- end -}}
+{{- end -}}
diff --git a/layouts/partials/comments.html b/layouts/partials/comments.html
deleted file mode 100644
index 1645d41..0000000
--- a/layouts/partials/comments.html
+++ /dev/null
@@ -1,101 +0,0 @@
-{{- if eq (getenv "HUGO_ENV") "production" | and .IsPage | and (ne .Params.comment false) -}}
- {{- /* Disqus Comment System */ -}}
- {{- with .Site.Params.disqus.shortname -}}
-
-
-
- {{- end -}}
-
- {{- /* Gitalk Comment System */ -}}
- {{- if .Site.Params.gitalk.owner -}}
-
- {{- if .Site.Params.cdn.gitalk_css -}}
- {{- .Site.Params.cdn.gitalk_css | safeHTML -}}
- {{- else -}}
- {{- $res := resources.Get "css/lib/gitalk/gitalk.css" | resources.Minify -}}
-
- {{- end -}}
- {{- if .Site.Params.cdn.gitalk_js -}}
- {{ .Site.Params.cdn.gitalk_js | safeHTML -}}
- {{- else -}}
- {{- $res := resources.Get "js/lib/gitalk/gitalk.min.js" | resources.Minify -}}
-
- {{- end -}}
-
-
- {{- end -}}
-
- {{- /* Valine Comment System */ -}}
- {{- if .Site.Params.valine.enable -}}
-
- {{- if .Site.Params.cdn.valine_js -}}
- {{- .Site.Params.cdn.valine_js | safeHTML -}}
- {{- else -}}
- {{- $res := resources.Get "js/lib/valine/Valine.min.js" | resources.Minify -}}
-
- {{- end -}}
-
-
- {{- end -}}
-
- {{- /* Facebook Comment System */ -}}
- {{- if .Site.Params.facebook.enable -}}
-
-
-
-
- {{- end -}}
-{{- end -}}
diff --git a/layouts/partials/head.html b/layouts/partials/head.html
deleted file mode 100644
index ff07135..0000000
--- a/layouts/partials/head.html
+++ /dev/null
@@ -1,77 +0,0 @@
-
-
-
-{{- with .Site.Params.google_verification -}}
-
-{{- end -}}
-{{- with .Site.Params.bing_verification -}}
-
-{{- end -}}
-{{- with .Site.Params.yandex_verification -}}
-
-{{- end -}}
-{{- with .Site.Params.pinterest_verification -}}
-
-{{- end -}}
-{{- with .Site.Params.baidu_verification -}}
-
-{{- end -}}
-{{- if .PrevInSection -}}
-
-{{- end -}}
-{{- if .NextInSection -}}
-
-{{- end -}}
-
-
-
-
-
-
-
-
-
-{{- with .OutputFormats.Get "RSS" -}}
-
-
-{{- end -}}
-
-{{- template "_internal/opengraph.html" . -}}
-
-{{- $share := .Params.share.enable | default .Site.Params.share.enable | eq true -}}
-{{- if $share | and (.Params.Share.Twitter | default .Site.Params.Share.Twitter | eq true) -}}
- {{- template "_internal/twitter_cards.html" . -}}
-{{- end -}}
-
-{{- partial "seo.html" . -}}
-
-{{- $options := dict "targetPath" "css/style.min.css" "outputStyle" "compressed" "enableSourceMap" true -}}
-{{- if fileExists "config/css/_custom.scss" -}}
- {{- $options = dict "includePaths" (slice "config/css") | merge $options -}}
- {{- $res := resources.Get "css/custom-style.scss" | toCSS $options -}}
-
-{{- else -}}
- {{- $res := resources.Get "css/style.scss" | toCSS $options -}}
-
-{{- end -}}
-
-{{- /* Font Awesome https://fontawesome.com/ */ -}}
-{{- if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.fontawesome_free_css -}}
- {{- .Site.Params.cdn.fontawesome_free_css | safeHTML -}}
-{{- else -}}
- {{- $res := resources.Get "css/lib/fontawesome-free/all.min.css" -}}
-
-{{- end -}}
-
-{{- /* Fork Awesome https://forkaweso.me/ */ -}}
-{{- $options := dict "targetPath" "css/lib/forkawesome/forkawesome.min.css" "outputStyle" "compressed" "enableSourceMap" true -}}
-{{- $res := resources.Get "css/lib/forkawesome/fork-awesome.scss"| toCSS $options -}}
-
-
-{{- /* Animate.css https://github.com/daneden/animate.css */ -}}
-{{- if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.animate_css -}}
- {{- .Site.Params.cdn.animate_css | safeHTML -}}
-{{- else -}}
- {{ $res := resources.Get "css/lib/animate/animate.min.css" -}}
-
-{{- end -}}
diff --git a/layouts/partials/head/link.html b/layouts/partials/head/link.html
new file mode 100644
index 0000000..92c6470
--- /dev/null
+++ b/layouts/partials/head/link.html
@@ -0,0 +1,51 @@
+{{- $CDN := .Scratch.Get "CDN" -}}
+
+
+
+
+
+
+
+
+
+{{- if .PrevInSection -}}
+
+{{- end -}}
+{{- if .NextInSection -}}
+
+{{- end -}}
+
+{{- with .OutputFormats.Get "RSS" -}}
+
+
+{{- end -}}
+
+{{- /* style.min.css */ -}}
+{{- $res := resources.Get "css/style.template.scss" -}}
+{{- $options := dict "targetPath" "css/style.min.css" "outputStyle" "compressed" "enableSourceMap" true -}}
+{{- if fileExists "config/css/_custom.scss" -}}
+ {{- $options = dict "includePaths" (slice "config/css") | merge $options -}}
+{{- end -}}
+{{- $res = resources.ExecuteAsTemplate "style.scss" . $res | toCSS $options -}}
+
+
+{{- /* Font Awesome https://fontawesome.com/ */ -}}
+{{- with $CDN.fontawesome_free_css -}}
+ {{- . | safeHTML -}}
+{{- else -}}
+ {{- $res := resources.Get "css/lib/fontawesome-free/all.min.css" -}}
+
+{{- end -}}
+
+{{- /* Fork Awesome https://forkaweso.me/ */ -}}
+{{- $options := dict "targetPath" "css/lib/forkawesome/fork-awesome.min.css" "outputStyle" "compressed" "enableSourceMap" true -}}
+{{- $res := resources.Get "css/lib/forkawesome/fork-awesome.scss"| toCSS $options -}}
+
+
+{{- /* Animate.css https://github.com/daneden/animate.css */ -}}
+{{- with $CDN.animate_css -}}
+ {{- . | safeHTML -}}
+{{- else -}}
+ {{ $res := resources.Get "css/lib/animate/animate.min.css" -}}
+
+{{- end -}}
diff --git a/layouts/partials/head/meta.html b/layouts/partials/head/meta.html
new file mode 100644
index 0000000..b41baeb
--- /dev/null
+++ b/layouts/partials/head/meta.html
@@ -0,0 +1,21 @@
+{{- with .Site.Params.google_verification -}}
+
+{{- end -}}
+{{- with .Site.Params.bing_verification -}}
+
+{{- end -}}
+{{- with .Site.Params.yandex_verification -}}
+
+{{- end -}}
+{{- with .Site.Params.pinterest_verification -}}
+
+{{- end -}}
+{{- with .Site.Params.baidu_verification -}}
+
+{{- end -}}
+
+{{- template "_internal/opengraph.html" . -}}
+{{- template "_internal/twitter_cards.html" . -}}
+
+
+
diff --git a/layouts/partials/seo.html b/layouts/partials/head/seo.html
similarity index 100%
rename from layouts/partials/seo.html
rename to layouts/partials/head/seo.html
diff --git a/layouts/partials/header.html b/layouts/partials/header.html
index 413e3e0..889fe85 100644
--- a/layouts/partials/header.html
+++ b/layouts/partials/header.html
@@ -1,12 +1,12 @@
-{{- /* Desktop navbar */ -}}
-
+ {{- /* Home mode [post] */ -}}
+ {{- if eq .Site.Params.home_mode "post" -}}
{{- /* Profile */ -}}
{{- partial "home/profile.html" . -}}
@@ -17,11 +17,11 @@
{{- .Render "summary" -}}
{{- end -}}
{{- partial "paginator.html" . -}}
-
- {{- /* Home mode [other] */ -}}
- {{- else -}}
- {{- /* Profile */ -}}
- {{- partial "home/profile.html" . -}}
- {{- end -}}
+ {{- /* Home mode [other] */ -}}
+ {{- else -}}
+ {{- /* Profile */ -}}
+ {{- partial "home/profile.html" . -}}
+ {{- end -}}
+