diff --git a/README.md b/README.md
index d7764bf6..7264d552 100644
--- a/README.md
+++ b/README.md
@@ -8,6 +8,17 @@ Some works are still in progress. See [TODOS](#todos) below.
## Install
+### As Hugo module (preferred)
+
+```toml
+# config.toml
+theme = "github.com/flypenguin/hugo-theme-cactus"
+```
+
+Now continue with step 3 below.
+
+### As git submodule
+
1. clone cactus to your hugo site's `themes` folder.
```
git clone https://github.com/monkeyWzr/hugo-theme-cactus.git themes/cactus
@@ -178,12 +189,14 @@ The `name` key expects the name of a [Font Awesome icon](https://fontawesome.com
### Copyright
-Assign your copy right to `.Site.Copyright`. Cactus will append current year to the head.
-
-TODO: Customizable copyright year
+Assign your copy right to `.Site.Params.Copyright.Name`.
```toml
-copyright = "Zeran Wu" # cactus theme will use site title if copyright is not set
+[params.copyright]
+ enabled = true # default
+ name = "Zeran Wu" # cactus will use title if copyright is not set
+ startYear = 2020 # if not provided, will use current year.
+ endYear = 2021 # if not provided, will use current year.
```
### Comments
@@ -193,17 +206,22 @@ Comments is disabled by default. Enable comments in your `.Site.Params`.
[params]
[params.comments]
enabled = true
- # engine = "disqus" # in progress
+ insert_hr_line = false # inserts an
element before comment block
+ engine = "disqus" # default if unset
+ # other options: disqus, utterances, cactus_comments, remark42
```
You can also enable/disable comments per post. in your posts' front matter, add:
+
```yaml
comments: true
```
The site config is ignored when `comments` option exists in front matter.
-The default engine is disqus. **By now only disqus is supported in cactus.** I will add more options sooner or later. See [Comments Alternatives](https://gohugo.io/content-management/comments/#comments-alternatives)
+#### Disqus notes
+
+The default engine is disqus.
Before using disqus, you need to register and get your [disqus shortname](https://help.disqus.com/en/articles/1717111-what-s-a-shortname). Assign your shortname in `.Site.disqusShortname`, or cactus will use `.Site.Title` by default.
@@ -211,6 +229,18 @@ Before using disqus, you need to register and get your [disqus shortname](https:
disqusShortname = "wzr" # cactus will use site title if not set
```
+#### Remark42 configuration
+
+```toml
+ [params.comments.remark42]
+ site_id = "changeme" # REQUIRED
+ url = "https://my.remark42.url" # REQUIRED
+ #locale = "en" # select locale, default "en"
+ #max_comments = 15 # display that many comments, default 15
+ #simple_view = false # enable simple view (no noticable effect?)
+ #theme = "light" # "light" | "dark", default "light"
+```
+
### highlight
Use hugo's built-in [syntax highlighting](https://gohugo.io/getting-started/configuration-markup#highlight).
@@ -233,6 +263,8 @@ default config:
### Analytics
+#### Google Analytics
+
Cactus uses hugo's bulit in analytics templates. Check [hugo's documents](https://gohugo.io/templates/internal#google-analytics) for details.
Set you tracking id in your site config.
@@ -246,6 +278,28 @@ If you are using Google Analytics v3 (analytics.js), you can switch to asynchron
googleAnalyticsAsync = true # not required
```
+#### Matomo
+
+Matomo can be configured by adding the [Hugo Matomo Module](https://github.com/holehan/hugo-component-matomo) and updating `config.toml` like this:
+
+```toml
+# in config.toml
+
+[[module.imports]]
+ path = 'github.com/holehan/hugo-components-matomo'
+
+[params]
+
+ # and add this line
+ [params.analytics.matomo]
+
+ # configure matomo settings, in detail described here:
+ # https://github.com/holehan/hugo-component-matomo
+ [params.matomo]
+ url = "https://example.org"
+ id = 1
+```
+
### RSS
The rss feed is not generated by default. you can enable it in your site config:
@@ -282,6 +336,17 @@ Pagination on posts archive can be disabled to show all posts in chronological o
showAllPostsArchive = true # or false (default)
```
+### Page image gallery
+
+If you have images in your page bundle the theme will add them at the top of your page.
+You can disable this behavior in `config.toml`.
+
+```toml
+# config.toml
+[params]
+ disable_gallery = true
+```
+
## TODOS
- [ ] More comments engines
@@ -290,7 +355,7 @@ Pagination on posts archive can be disabled to show all posts in chronological o
- [x] Analytics
- [ ] Local Search
- [ ] toc template
-- [ ] Customizable copyright year
+- [x] Customizable copyright year
- [ ] gallery
- [ ] expose [mathjax configuration](https://docs.mathjax.org/en/latest/web/configuration.html#web-configuration)
diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index a57fbe91..71d40214 100644
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -2,7 +2,7 @@ baseURL = "https://example.com"
languageCode = "en-us"
title = "Cactus theme example"
theme = "cactus"
-copyright = "You" # cactus will use title if copyright is not set
+copyright = "You" # deprecated, please use params.copyright
disqusShortname = "example" # Used when comments is enabled. Cactus will use site title if not set
# googleAnalytics = "UA-1234-5"
@@ -81,6 +81,14 @@ weight = 4
#serverUrl = "" # Defaults to https://matrix.cactus.chat:8448 (Cactus Chat public server)
#serverName = "" # Defaults to cactus.chat
+ # Customize the copyright years
+ # Note: if startYear/endYear not provided, will use current year.
+ [params.copyright]
+ enabled = true # default
+ name = "You" # cactus will use title if copyright is not set
+ startYear = 2021
+ endYear = 2021
+
# the value of name should be an valid font awesome icon name (brands type)
# https://fontawesome.com/icons?d=gallery&s=brands
[[params.social]]
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
index f7a3080b..4ad7d78d 100644
--- a/layouts/_default/baseof.html
+++ b/layouts/_default/baseof.html
@@ -1,6 +1,7 @@
{{ partial "head.html" . }}
+
@@ -17,4 +18,8 @@
+{{- if (isset .Site.Params "matomo") }}
+{{ partial "matomo-tracking" . }}
+{{- end }}
+
diff --git a/layouts/partials/comments.html b/layouts/partials/comments.html
index b17721e8..e01f7619 100644
--- a/layouts/partials/comments.html
+++ b/layouts/partials/comments.html
@@ -1,15 +1,7 @@
-{{ if (not (isset .Site.Params "comments")) }}
- {{ .Scratch.Set "enable_comments" false }}
-{{ else if (isset .Params "comments") }}
- {{ .Scratch.Set "enable_comments" .Params.comments }}
-{{ else if (isset .Site.Params.Comments "enabled") }}
- {{ .Scratch.Set "enable_comments" .Site.Params.Comments.Enabled }}
-{{ else }}
- {{ .Scratch.Set "enable_comments" true }}
-{{ end }}
-
{{ $enable_comments := .Scratch.Get "enable_comments" }}
-{{ if $enable_comments }}
+{{ if $enable_comments -}}
+{{- if .Site.Params.Comments.insert_hr_line -}}
+{{ end -}}