From e860fc9bfa717a34faaca161707e003f5e88cfc9 Mon Sep 17 00:00:00 2001
From: Alexander Bilz <mail@alexbilz.com>
Date: Tue, 05 May 2020 12:38:00 +0000
Subject: [PATCH] Added option for custom CSS

---
 exampleSite/config.toml    |    1 +
 layouts/partials/head.html |    3 +++
 README.md                  |   19 ++++++++++++++-----
 3 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/README.md b/README.md
index 2270e22..7367af0 100644
--- a/README.md
+++ b/README.md
@@ -15,6 +15,7 @@
 * Katex support
 * MIT License
 * Fontawesome icons
+* Custom CSS
 
 ## Preview the exampleSite
 ```
@@ -38,7 +39,7 @@
 Ìn this section I'll discuss the custom parameters available within the `config.toml`. The complete [sample](https://github.com/lxndrblz/anatole/blob/master/exampleSite/config.toml) can be found in the exampleSite folder. 
 
 ### Profile picture and slogan
-```
+```toml
 [params]
 title = "I'm Jane Doe"
 author = "Jane Doe"
@@ -47,7 +48,7 @@
 ```
 ### Navigation items
 Non-content entries can be added right from the `config.toml` file.
-```
+```toml
 [menu]
 
   [[menu.main]]
@@ -70,22 +71,30 @@
 ```
 ### Comments powered by Disqus
 No comment section is shown on the `single.html`, unless a disqus code is specified in the `config.toml` file.
-```
+```toml
 disqusShortname = "XXX"
 ```
 ### Google Analytics
 To use Google Analytics, a valid tracking code has to be added. If you don't want to load the code, then commend out the parameter.
-```
+```toml
 googleAnalytics = "UA-123-45"
 ```
 
 ### Beautiful math functions
-```
+```toml
 ## Math settings
 [params.math]
 enable = false  # options: true, false. Enable math support globally, default: false. You can always enable math on per page.
 use = "katex"  # options: "katex", "mathjax". default is "katex".
 ```
+
+### Custom CSS
+You can add your custom CSS files with the `customCss` parameter of the configuration file. Put your files into the `static/css` directory.
+
+```toml
+customCss = ["css/custom1.css", "css/custom2.css"]
+```
+
 ## License
 
 Anatole is licensed under the [MIT license](https://github.com/lxndrblz/anatole/blob/master/LICENSE).
diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index c3f74a6..56c4efa 100644
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -19,6 +19,7 @@
 profilePicture = "images/profile.jpg"
 keywords = ""
 favicon = "favicons/"
+customCss = []
 
 ## Math settings
 [params.math]
diff --git a/layouts/partials/head.html b/layouts/partials/head.html
index bd2434d..179c5e9 100644
--- a/layouts/partials/head.html
+++ b/layouts/partials/head.html
@@ -5,6 +5,9 @@
     <meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover">
     <meta name="description" content="{{ .Site.Params.description }}">
     <link rel="stylesheet" href="{{ `css/style.css` | absURL }}" type="text/css">
+    {{ range .Site.Params.customCss -}}
+    <link rel="stylesheet" href="{{ . | absURL }}" type="text/css">
+    {{- end }}
     <link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
     <base href="{{ .Site.BaseURL }}">
     <!-- Favicons -->

--
Gitblit v1.10.0