diff options
author | Lars Kruse <devel@sumpfralle.de> | 2020-11-03 04:44:57 +0300 |
---|---|---|
committer | Lars Kruse <devel@sumpfralle.de> | 2020-11-03 04:44:57 +0300 |
commit | a750446c6fe1d3c23f5ee5af542b65ad062da590 (patch) | |
tree | 0d214599401f577b5e61ab38b8f3834e48bedc88 | |
parent | c29ef66a85f50b1248fe07b8fe095a7907257aa1 (diff) |
Add custom_css parameter
The documentation is copied from hugo-octopress.
-rw-r--r-- | exampleSite/content/configuration/_index.md | 12 | ||||
-rw-r--r-- | layouts/partials/head.html | 4 |
2 files changed, 16 insertions, 0 deletions
diff --git a/exampleSite/content/configuration/_index.md b/exampleSite/content/configuration/_index.md index 244df9b..8eb4f3e 100644 --- a/exampleSite/content/configuration/_index.md +++ b/exampleSite/content/configuration/_index.md @@ -54,3 +54,15 @@ Disable search by setting <code>disableSearch = true</code> in <code>config.toml The local search feature is based on the content of `index.json`, which is generated based on a configurable template. Search results are presented as a drop-down list attached to the search input field while typing. + + +## Custom CSS + +You can override the built-in css by using your own. Just put your own css files in the `static` directory of your website (the one in the theme directory also works but is not recommended) and modify the `custom_css` parameter in your config file. The path referenced in the parameter should be relative to the `static` folder. These css files will be added through the `header` partial after the built-in css file. + +For example, if your css files are `static/css/custom.css` and `static/css/custom2.css` then add the following to the config file: + +``` + [params] + custom_css = ["css/custom.css","css/custom2.css"] +``` diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 1e7e079..1673635 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -17,6 +17,10 @@ {{ $style := resources.Get "css/ace.scss" | toCSS | minify }} <link rel="stylesheet" href="{{ $style.Permalink }}"> + {{ range .Site.Params.custom_css }} + <link rel="stylesheet" href="{{ $.Site.BaseURL }}{{ . }}"> + {{ end }} + <!-- Only include the tracking when using `hugo` or adding `--environment production` --> {{ if eq hugo.Environment "production" }} {{ template "_internal/google_analytics_async.html" . }} |