diff --git a/README.md b/README.md index ab422ff3..eb2263c7 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,7 @@ A technology-minded theme for Hugo based on VMware's open-source [Clarity Design * [Custom CSS and JS](#custom-css-and-js) * [Forcing light or dark mode](#forcing-light-or-dark-mode) * [Internationalization - I18N](#i18n) + * [Hooks](#hooks) * [Comments](#comments) ## Features @@ -429,6 +430,22 @@ Things to consider in multilingual: * **menu's languages list** are semi-hardcoded. You may chose another text for the menu entry with [languageMenuName](./exampleSite/config.toml). Please, do better and create a PR for that. * **content** must be translated individually. Read the [official documentation](https://gohugo.io/content-management/multilingual/#translate-your-content) for information on how to do it. +### Hooks + +Clarity provides some hooks for adding code on page. + +If you need to add some code(CSS import, HTML meta or similar) to the head section on every page, add a partial to your project: + +``` +layouts/partials/hooks/head-end.html +``` + +Similar, if you want to add some code right before the body end, create your own version of the following file: + +``` +layouts/partials/hooks/body-end.html +``` + ### Comments Clarity supports Hugo built-in Disqus partial, you can enable Disqus simply by setting `disqusShortname` in your configuration file. diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 8925d61a..4129e820 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -41,7 +41,7 @@ {{- end }} {{- end }} - + {{ partial "hooks/head-end.html" . }} {{- $maxCodeLines := 100 }} {{- $params := .Site.Params }} @@ -76,5 +76,6 @@ {{- end }} {{- end }} + {{ partial "hooks/body-end.html" . }} diff --git a/layouts/partials/hooks/body-end.html b/layouts/partials/hooks/body-end.html new file mode 100644 index 00000000..e69de29b diff --git a/layouts/partials/hooks/head-end.html b/layouts/partials/hooks/head-end.html new file mode 100644 index 00000000..e69de29b