From 269713b589a6fc304304723f3febf2b0448a1705 Mon Sep 17 00:00:00 2001 From: Arnab Kumar Shil Date: Sun, 30 Dec 2018 12:49:24 +0600 Subject: [PATCH] Add custom css support (#21) --- README.md | 8 ++++++++ exampleSite/config.toml | 2 +- layouts/_default/baseof.html | 3 +++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 118663f..dd8919a 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,14 @@ The following icons are supported, please make sure the `name` filed is exactly * Keep your regular pages in the `content` folder. To create a new page, run `hugo new page-title.md` * Keep your blog posts in the `content/posts` folder. To create a new post, run `hugo new posts/post-title.md` +### Add custom css +For adding custom css to the theme, you need to assign an array of references in `config.toml` like following: +``` +[params] + custom_css = ["css/foo.css", "css/bar.css"] +``` +You can reference as many stylesheets as you want. Their paths need to be relative to the `static` folder. + ## Acknowledgments * [normalize.css](https://necolas.github.io/normalize.css/) - [MIT](https://github.com/necolas/normalize.css/blob/master/LICENSE.md) diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 93b6d81..10eb6e0 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -35,7 +35,7 @@ enableEmoji = true # Shorthand emojis in content files - https://gohugo.io/func # gitUrl = "https://github.com/Someone/SomeRepo/commit/" # Prefix of link to the git commit detail page. GitInfo must be enabled. justifyContent = false # Set "text-align: justify" to .content, requires extended version of Hugo # bgImg = "" # Homepage background-image URL - + # customCSS = ["css/foo.css", "css/bar.css"] # add custom css # Social Icons # Check https://github.com/Track3/hermit#social-icons for more info. [[params.social]] diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 5f7e408..0a4bd7b 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -25,6 +25,9 @@ {{ $style := resources.Get "scss/style.scss" | resources.ExecuteAsTemplate "css/style.css" . | toCSS | minify | fingerprint -}} {{ block "head" . -}}{{- end }} + {{ range .Site.Params.CustomCSS -}} + + {{- end }}