From 584768ad6a35db31a99aaceb1850e7d7c317ee5f Mon Sep 17 00:00:00 2001 From: Shanhe Yi <838961+yishanhe@users.noreply.github.com> Date: Sat, 4 Sep 2021 23:54:12 -0700 Subject: [PATCH] add customizable copyright - years can be configured - fix #56 copyright can be enabled/disabled - moved all copyright config under .Site.Params.Copyright --- README.md | 12 +++++++----- exampleSite/config.toml | 10 +++++++++- layouts/partials/footer.html | 12 +++++++++++- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index d7764bf6..a504e156 100644 --- a/README.md +++ b/README.md @@ -178,12 +178,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 @@ -290,7 +292,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/partials/footer.html b/layouts/partials/footer.html index 31eb4aa8..c5a4c952 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -1,7 +1,17 @@