Skip to content

Commit

Permalink
Merge pull request #50 from razonyang/feature-hooks
Browse files Browse the repository at this point in the history
Add hooks
  • Loading branch information
onweru authored Sep 28, 2020
2 parents d770af1 + 2a592cd commit 7a32c6a
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
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.

0 comments on commit 7a32c6a

Please # to comment.