From 9752a70c09165da572776c85dc2c1472870af671 Mon Sep 17 00:00:00 2001 From: Tanner Smith Date: Wed, 3 Jun 2020 16:01:01 -0500 Subject: [PATCH] Add head partial (#285) * Add head-additions partial --- README.md | 5 +++++ layouts/_default/baseof.html | 1 + layouts/partials/head-additions.html | 0 3 files changed, 6 insertions(+) create mode 100644 layouts/partials/head-additions.html diff --git a/README.md b/README.md index 50e31d4..fd8beeb 100644 --- a/README.md +++ b/README.md @@ -141,6 +141,11 @@ For example, if your css files are `static/css/custom.css` and `static/css/custo If you add a key of `show_reading_time` true to either the Config Params, a page or section's front matter, articles will show the reading time and word count. +### Adding Scripts to the Page Head + +Some scripts need to be added within the page head. To add your own scripts to the page head, simply insert them into the `head-additions.html` partial located in the `layouts/partials` folder. + + ### Nearly finished In order to see your site in action, run Hugo's built-in local server. diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 09622d4..ff53aa9 100755 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -42,6 +42,7 @@ {{ if eq (getenv "HUGO_ENV") "production" | or (eq .Site.Params.env "production") }} {{ template "_internal/google_analytics_async.html" . }} {{ end }} + {{ block "head" . }}{{ partial "head-additions.html" }}{{ end }} diff --git a/layouts/partials/head-additions.html b/layouts/partials/head-additions.html new file mode 100644 index 0000000..e69de29