From e8fc700483d4041b0b2c0af7bbbe374b84a1ef29 Mon Sep 17 00:00:00 2001 From: Julian Stier Date: Thu, 12 Mar 2020 15:14:16 +0100 Subject: [PATCH 1/5] Added possibility of custom footer; some of the code could be further centralized --- layouts/partials/footer/custom.html | 0 layouts/partials/footer/footer.html | 2 ++ layouts/partials/page-list/footer.html | 2 +- layouts/partials/page-single/footer.html | 2 +- layouts/partials/portfolio/footer.html | 2 +- 5 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 layouts/partials/footer/custom.html create mode 100644 layouts/partials/footer/footer.html diff --git a/layouts/partials/footer/custom.html b/layouts/partials/footer/custom.html new file mode 100644 index 0000000..e69de29 diff --git a/layouts/partials/footer/footer.html b/layouts/partials/footer/footer.html new file mode 100644 index 0000000..115fed3 --- /dev/null +++ b/layouts/partials/footer/footer.html @@ -0,0 +1,2 @@ +{{ partial "footer/font-awesome-js.html" . }} +{{ partial "footer/custom.html" . }} diff --git a/layouts/partials/page-list/footer.html b/layouts/partials/page-list/footer.html index 2579155..603cd63 100644 --- a/layouts/partials/page-list/footer.html +++ b/layouts/partials/page-list/footer.html @@ -2,4 +2,4 @@ {{ template "_internal/google_analytics_async.html" . }} {{ end }} -{{ partial "footer/font-awesome-js.html" . }} +{{ partial "footer/footer.html" . }} diff --git a/layouts/partials/page-single/footer.html b/layouts/partials/page-single/footer.html index 7f23337..44a3d51 100644 --- a/layouts/partials/page-single/footer.html +++ b/layouts/partials/page-single/footer.html @@ -3,7 +3,7 @@ {{ template "_internal/google_analytics_async.html" . }} {{ end }} -{{ partial "footer/font-awesome-js.html" . }} +{{ partial "footer/footer.html" . }} {{ partial "highlight-js.html" . }} {{ with .Site.Params.toc }} {{ if and (eq . "tocbot") (ne $include_toc false) }} diff --git a/layouts/partials/portfolio/footer.html b/layouts/partials/portfolio/footer.html index 2579155..603cd63 100644 --- a/layouts/partials/portfolio/footer.html +++ b/layouts/partials/portfolio/footer.html @@ -2,4 +2,4 @@ {{ template "_internal/google_analytics_async.html" . }} {{ end }} -{{ partial "footer/font-awesome-js.html" . }} +{{ partial "footer/footer.html" . }} From cc8eee2d77ed495b90a6f2ec327e63fcba7e3fc4 Mon Sep 17 00:00:00 2001 From: Julian Stier Date: Thu, 12 Mar 2020 15:32:30 +0100 Subject: [PATCH 2/5] Adding possibility for custom body html injection outside of installed theme --- layouts/_default/baseof.html | 1 + layouts/index.html | 6 +----- layouts/partials/body/custom.html | 0 layouts/partials/footer.html | 6 ++++++ layouts/partials/footer/footer.html | 2 -- 5 files changed, 8 insertions(+), 7 deletions(-) create mode 100644 layouts/partials/body/custom.html create mode 100644 layouts/partials/footer.html delete mode 100644 layouts/partials/footer/footer.html diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index f0da4d0..cc6c0bc 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -2,6 +2,7 @@ {{ block "header" . }}{{ end }} + {{ partial "body/custom.html" . }} {{ partial "sidebar.html" . }}
{{ block "content" . }}{{ end }} diff --git a/layouts/index.html b/layouts/index.html index c1a00bb..4f011a6 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -36,9 +36,5 @@ {{ end }} {{ define "footer" }} - {{ if .Site.GoogleAnalytics }} - - {{ template "_internal/google_analytics_async.html" . }} - {{ end }} - {{ partial "footer/font-awesome-js.html" . }} + {{ partial "footer.html" . }} {{ end }} diff --git a/layouts/partials/body/custom.html b/layouts/partials/body/custom.html new file mode 100644 index 0000000..e69de29 diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html new file mode 100644 index 0000000..f83aeac --- /dev/null +++ b/layouts/partials/footer.html @@ -0,0 +1,6 @@ +{{ if .Site.GoogleAnalytics }} + + {{ template "_internal/google_analytics_async.html" . }} +{{ end }} +{{ partial "footer/font-awesome-js.html" . }} +{{ partial "footer/custom.html" . }} diff --git a/layouts/partials/footer/footer.html b/layouts/partials/footer/footer.html deleted file mode 100644 index 115fed3..0000000 --- a/layouts/partials/footer/footer.html +++ /dev/null @@ -1,2 +0,0 @@ -{{ partial "footer/font-awesome-js.html" . }} -{{ partial "footer/custom.html" . }} From a850fc72015b545c5aae8839f806173f6c618514 Mon Sep 17 00:00:00 2001 From: Julian Stier Date: Thu, 12 Mar 2020 15:36:59 +0100 Subject: [PATCH 3/5] Removed references to footer/footer partial --- layouts/partials/page-list/footer.html | 1 - layouts/partials/page-single/footer.html | 1 - layouts/partials/portfolio/footer.html | 1 - 3 files changed, 3 deletions(-) diff --git a/layouts/partials/page-list/footer.html b/layouts/partials/page-list/footer.html index 603cd63..43e25c1 100644 --- a/layouts/partials/page-list/footer.html +++ b/layouts/partials/page-list/footer.html @@ -2,4 +2,3 @@ {{ template "_internal/google_analytics_async.html" . }} {{ end }} -{{ partial "footer/footer.html" . }} diff --git a/layouts/partials/page-single/footer.html b/layouts/partials/page-single/footer.html index 44a3d51..5d7378f 100644 --- a/layouts/partials/page-single/footer.html +++ b/layouts/partials/page-single/footer.html @@ -3,7 +3,6 @@ {{ template "_internal/google_analytics_async.html" . }} {{ end }} -{{ partial "footer/footer.html" . }} {{ partial "highlight-js.html" . }} {{ with .Site.Params.toc }} {{ if and (eq . "tocbot") (ne $include_toc false) }} diff --git a/layouts/partials/portfolio/footer.html b/layouts/partials/portfolio/footer.html index 603cd63..43e25c1 100644 --- a/layouts/partials/portfolio/footer.html +++ b/layouts/partials/portfolio/footer.html @@ -2,4 +2,3 @@ {{ template "_internal/google_analytics_async.html" . }} {{ end }} -{{ partial "footer/footer.html" . }} From 3520ff123d6a46e8af8db87df23fac89e13b1b41 Mon Sep 17 00:00:00 2001 From: Julian Stier Date: Thu, 12 Mar 2020 15:45:10 +0100 Subject: [PATCH 4/5] Made redundant footer code reference original footer partial --- layouts/partials/page-list/footer.html | 5 +---- layouts/partials/page-single/footer.html | 6 ++---- layouts/partials/portfolio/footer.html | 5 +---- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/layouts/partials/page-list/footer.html b/layouts/partials/page-list/footer.html index 43e25c1..05d6961 100644 --- a/layouts/partials/page-list/footer.html +++ b/layouts/partials/page-list/footer.html @@ -1,4 +1 @@ -{{ if .Site.GoogleAnalytics }} - - {{ template "_internal/google_analytics_async.html" . }} -{{ end }} +{{ partial "footer.html" . }} diff --git a/layouts/partials/page-single/footer.html b/layouts/partials/page-single/footer.html index 5d7378f..6aed250 100644 --- a/layouts/partials/page-single/footer.html +++ b/layouts/partials/page-single/footer.html @@ -1,8 +1,6 @@ +{{ partial "footer.html" . }} + {{ $include_toc := .Params.include_toc}} -{{ if .Site.GoogleAnalytics }} - - {{ template "_internal/google_analytics_async.html" . }} -{{ end }} {{ partial "highlight-js.html" . }} {{ with .Site.Params.toc }} {{ if and (eq . "tocbot") (ne $include_toc false) }} diff --git a/layouts/partials/portfolio/footer.html b/layouts/partials/portfolio/footer.html index 43e25c1..05d6961 100644 --- a/layouts/partials/portfolio/footer.html +++ b/layouts/partials/portfolio/footer.html @@ -1,4 +1 @@ -{{ if .Site.GoogleAnalytics }} - - {{ template "_internal/google_analytics_async.html" . }} -{{ end }} +{{ partial "footer.html" . }} From 5046967a61426fad7dd125bae1ca45645a0f9264 Mon Sep 17 00:00:00 2001 From: Julian Stier Date: Tue, 24 Mar 2020 19:54:14 +0100 Subject: [PATCH 5/5] Fixing hightlight-js embedding error 'hljs is not defined' when highlightjs is not configured in hugo --- layouts/partials/highlight-js.html | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/layouts/partials/highlight-js.html b/layouts/partials/highlight-js.html index 87c347d..361d860 100644 --- a/layouts/partials/highlight-js.html +++ b/layouts/partials/highlight-js.html @@ -7,12 +7,12 @@ {{ end }} {{ end }} + {{ end }} - {{ $.Scratch.Delete "hl_languages" }} {{ end }}