Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add hooks #50

Merged
merged 2 commits into from
Sep 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
3 changes: 2 additions & 1 deletion layouts/_default/baseof.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<link rel="stylesheet" href="{{ . | relURL }}">
{{- end }}
{{- end }}
{{ partial "hooks/head-end.html" . }}
</head>
{{- $maxCodeLines := 100 }}
{{- $params := .Site.Params }}
Expand Down Expand Up @@ -76,5 +76,6 @@
<script type="text/javascript" src="{{ . | relURL }}" ></script>
{{- end }}
{{- end }}
{{ partial "hooks/body-end.html" . }}
</body>
</html>
Empty file.
Empty file.