Skip to content

Commit

Permalink
feat(cookies): add Cookie consent banner (#355)
Browse files Browse the repository at this point in the history
  • Loading branch information
dillonzq authored May 13, 2020
1 parent 8d49150 commit 0a9ec97
Show file tree
Hide file tree
Showing 32 changed files with 237 additions and 44 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ I hope you will LoveIt ❤️!
* **Custom style** shortcode
* **Animated typing** supported by [TypeIt](https://typeitjs.com/)
* **Dynamic scroll** supported by [Smooth Scroll](https://github.com/cferdinandi/smooth-scroll)
* **Cookie consent banner** supported by [cookieconsent](https://github.com/osano/cookieconsent)
* ...

## [Documentation](https://hugoloveit.com/categories/documentation/)
Expand Down Expand Up @@ -176,6 +177,7 @@ Thanks to the authors of following resources included in the theme:
* [MetingJS](https://github.com/metowolf/MetingJS)
* [Gitalk](https://github.com/gitalk/gitalk)
* [Valine](https://valine.js.org/)
* [cookieconsent](https://github.com/osano/cookieconsent)

## Author

Expand Down
2 changes: 2 additions & 0 deletions README.zh-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
* 支持**自定义样式**的 shortcode
* 支持基于 [TypeIt](https://typeitjs.com/)**打字动画** shortcode
* 支持基于 [Smooth Scroll](https://github.com/cferdinandi/smooth-scroll)**滚动动画**
* 支持基于 [cookieconsent](https://github.com/osano/cookieconsent)**Cookie 许可横幅**
* ...

## [文档](https://hugoloveit.com/zh-cn/categories/documentation/)
Expand Down Expand Up @@ -171,6 +172,7 @@ LoveIt 主题中用到了以下项目,感谢它们的作者:
* [MetingJS](https://github.com/metowolf/MetingJS)
* [Gitalk](https://github.com/gitalk/gitalk)
* [Valine](https://valine.js.org/)
* [cookieconsent](https://github.com/osano/cookieconsent)

## 作者

Expand Down
1 change: 1 addition & 0 deletions assets/css/_core/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ body {
@import "../_partial/icon";
@import "../_partial/details";
@import "../_partial/fixed-button";
@import "../_partial/cookieconsent";

img {
@include object-fit(contain);
Expand Down
17 changes: 17 additions & 0 deletions assets/css/_partial/_cookieconsent.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.cc-window.cc-banner {
.cc-btn {
color: $global-font-color;

&:hover, &:focus {
background-color: #ccc;
}

[theme=dark] & {
color: $global-font-color;

&:hover, &:focus {
background-color: #fff;
}
}
}
}
3 changes: 3 additions & 0 deletions assets/data/cdn/jsdelivr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,6 @@ libFiles:
gitalkJS: gitalk@1.6.2/dist/gitalk.min.js
# valine@1.4.14 https://valine.js.org/
valineJS: valine@1.4.14/dist/Valine.min.js
# cookieconsent@3.1.1 https://github.com/osano/cookieconsent
cookieconsentCSS: cookieconsent@3.1.1/build/cookieconsent.min.css
cookieconsentJS: cookieconsent@3.1.1/build/cookieconsent.min.js
2 changes: 1 addition & 1 deletion assets/js/theme.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/js/theme.min.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions assets/lib/VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ aplayer@1.10.1 https://github.com/MoePlayer/APlayer
meting@2.0.1 https://github.com/metowolf/MetingJS
gitalk@1.6.2 https://github.com/gitalk/gitalk
valine@1.4.14 https://valine.js.org/
cookieconsent@3.1.1 https://github.com/osano/cookieconsent
6 changes: 6 additions & 0 deletions assets/lib/cookieconsent/cookieconsent.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions assets/lib/cookieconsent/cookieconsent.min.js

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions exampleSite/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -986,6 +986,17 @@ enableEmoji = true
# 自行托管追踪器时的主机路径
server = ""

# Cookie consent config
# Cookie 许可配置
[params.cookieconsent]
enable = false
# text strings used for Cookie consent banner
# 用于 Cookie 许可横幅的文本字符串
[params.cookieconsent.content]
message = ""
dismiss = ""
link = ""

# CDN config for third-party library files
# 第三方库文件的 CDN 设置
[params.cdn]
Expand Down
2 changes: 2 additions & 0 deletions exampleSite/content/about/index.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ math:
* :(fas fa-align-left fa-fw): **Custom style** shortcode
* :(fas fa-i-cursor fa-fw): **Animated typing** supported by [TypeIt](https://typeitjs.com/)
* :(fas fa-arrow-down fa-fw): **Dynamic scroll** supported by [Smooth Scroll](https://github.com/cferdinandi/smooth-scroll)
* :(fas fa-cookie-bite fa-fw): **Cookie consent banner** supported by [cookieconsent](https://github.com/osano/cookieconsent)
* ...

### License
Expand Down Expand Up @@ -112,3 +113,4 @@ Thanks to the authors of following resources included in the theme:
* [MetingJS](https://github.com/metowolf/MetingJS)
* [Gitalk](https://github.com/gitalk/gitalk)
* [Valine](https://valine.js.org/)
* [cookieconsent](https://github.com/osano/cookieconsent)
2 changes: 2 additions & 0 deletions exampleSite/content/about/index.fr.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ Welcome to take the time to propose a translation by [:(fas fa-code-branch fa-fw
* :(fas fa-align-left fa-fw): **Custom style** shortcode
* :(fas fa-i-cursor fa-fw): **Animated typing** supported by [TypeIt](https://typeitjs.com/)
* :(fas fa-arrow-down fa-fw): **Dynamic scroll** supported by [Smooth Scroll](https://github.com/cferdinandi/smooth-scroll)
* :(fas fa-cookie-bite fa-fw): **Cookie consent banner** supported by [cookieconsent](https://github.com/osano/cookieconsent)
* ...

### License
Expand Down Expand Up @@ -117,3 +118,4 @@ Thanks to the authors of following resources included in the theme:
* [MetingJS](https://github.com/metowolf/MetingJS)
* [Gitalk](https://github.com/gitalk/gitalk)
* [Valine](https://valine.js.org/)
* [cookieconsent](https://github.com/osano/cookieconsent)
2 changes: 2 additions & 0 deletions exampleSite/content/about/index.zh-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ math:
* :(fas fa-align-left fa-fw): 支持**自定义样式**的 shortcode
* :(fas fa-i-cursor fa-fw): 支持基于 [TypeIt](https://typeitjs.com/)**打字动画** shortcode
* :(fas fa-arrow-down fa-fw): 支持基于 [Smooth Scroll](https://github.com/cferdinandi/smooth-scroll)**滚动动画**
* :(fas fa-cookie-bite fa-fw): 支持基于 [cookieconsent](https://github.com/osano/cookieconsent)**Cookie 许可横幅**
* ...

### 许可协议
Expand Down Expand Up @@ -112,3 +113,4 @@ LoveIt 主题中用到了以下项目,感谢它们的作者:
* [MetingJS](https://github.com/metowolf/MetingJS)
* [Gitalk](https://github.com/gitalk/gitalk)
* [Valine](https://valine.js.org/)
* [cookieconsent](https://github.com/osano/cookieconsent)
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,15 @@ Please open the code block below to view the complete sample configuration :(far
# server url for your tracker if you're self hosting
server = ""

# {{< version 0.2.7 >}} Cookie consent config
[params.cookieconsent]
enable = true
# text strings used for Cookie consent banner
[params.cookieconsent.content]
message = ""
dismiss = ""
link = ""

# {{< version 0.2.7 changed >}} CDN config for third-party library files
[params.cdn]
# CDN data file name, disabled by default
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,15 @@ Please open the code block below to view the complete sample configuration :(far
# server url for your tracker if you're self hosting
server = ""

# {{< version 0.2.7 >}} Cookie consent config
[params.cookieconsent]
enable = true
# text strings used for Cookie consent banner
[params.cookieconsent.content]
message = ""
dismiss = ""
link = ""

# {{< version 0.2.7 changed >}} CDN config for third-party library files
[params.cdn]
# CDN data file name, disabled by default
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,15 @@ hugo
# 自行托管追踪器时的主机路径
server = ""

# {{< version 0.2.7 >}} Cookie 许可配置
[params.cookieconsent]
enable = true
# 用于 Cookie 许可横幅的文本字符串
[params.cookieconsent.content]
message = ""
dismiss = ""
link = ""

# {{< version 0.2.7 changed >}} 第三方库文件的 CDN 设置
[params.cdn]
# CDN 数据文件名称, 默认不启用
Expand Down
9 changes: 9 additions & 0 deletions i18n/de.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,15 @@ other = "lib/lunr/lunr.de.js"

[copyToClipboard]
other = "In Zwischenablage kopieren"

[cookieconsentMessage]
other = "Diese Website verwendet Cookies, um Ihre Erfahrung zu verbessern."

[cookieconsentDismiss]
other = "Zustimmen"

[cookieconsentLink]
other = "Erfahren Sie mehr"
# === partials/assets.html ===

# === partials/plugin/share.html ===
Expand Down
9 changes: 9 additions & 0 deletions i18n/en.toml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,15 @@ other = "en"

[copyToClipboard]
other = "Copy to clipboard"

[cookieconsentMessage]
other = "This website uses Cookies to improve your experience."

[cookieconsentDismiss]
other = "Got it!"

[cookieconsentLink]
other = "Learn more"
# === partials/assets.html ===

# === partials/plugin/share.html ===
Expand Down
9 changes: 9 additions & 0 deletions i18n/es.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,15 @@ other = "lib/lunr/lunr.es.js"

[copyToClipboard]
other = "Copiar al portapapeles"

[cookieconsentMessage]
other = "Este sitio web utiliza Cookies para mejorar su experiencia."

[cookieconsentDismiss]
other = "De acuerdo"

[cookieconsentLink]
other = "Aprende más"
# === partials/assets.html ===

# === partials/plugin/share.html ===
Expand Down
9 changes: 9 additions & 0 deletions i18n/fr.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,15 @@ other = "lib/lunr/lunr.fr.js"

[copyToClipboard]
other = "Copier dans le presse-papiers"

[cookieconsentMessage]
other = "Ce site Web utilise des Cookies pour améliorer votre expérience."

[cookieconsentDismiss]
other = "Se mettre d'accord"

[cookieconsentLink]
other = "Apprendre encore plus"
# === partials/assets.html ===

# === partials/plugin/share.html ===
Expand Down
9 changes: 9 additions & 0 deletions i18n/it.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,15 @@ other = "lib/lunr/lunr.it.js"

[copyToClipboard]
other = "Copia negli appunti"

[cookieconsentMessage]
other = "Questo sito Web utilizza i Cookies per migliorare la tua esperienza."

[cookieconsentDismiss]
other = "Essere d'accordo"

[cookieconsentLink]
other = "Per saperne di più"
# === partials/assets.html ===

# === partials/plugin/share.html ===
Expand Down
9 changes: 9 additions & 0 deletions i18n/pl.toml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,15 @@ other = "Strona główna"

[readMore]
other = "Czytaj więcej"

[cookieconsentMessage]
other = "Ta strona korzysta z plików Cookies, aby poprawić komfort użytkowania."

[cookieconsentDismiss]
other = "Zgodzić się"

[cookieconsentLink]
other = "Ucz się więcej"
# === posts/single.html ===

# === 404.html ===
Expand Down
9 changes: 9 additions & 0 deletions i18n/pt-BR.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,15 @@ other = "lib/lunr/lunr.pt.js"

[copyToClipboard]
other = "Copiar para a área de transferência"

[cookieconsentMessage]
other = "Este site usa Cookies para melhorar sua experiência."

[cookieconsentDismiss]
other = "Aceita"

[cookieconsentLink]
other = "Saber mais"
# === partials/assets.html ===

# === partials/plugin/share.html ===
Expand Down
9 changes: 9 additions & 0 deletions i18n/ro.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,15 @@ other = "lib/lunr/lunr.ro.js"

[copyToClipboard]
other = "Copiați în clipboard"

[cookieconsentMessage]
other = "Acest site web utilizează Cookies pentru a vă îmbunătăți experiența."

[cookieconsentDismiss]
other = "De acord"

[cookieconsentLink]
other = "Aflați mai multe"
# === partials/assets.html ===

# === partials/plugin/share.html ===
Expand Down
9 changes: 9 additions & 0 deletions i18n/ru.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,15 @@ other = "lib/lunr/lunr.ru.js"

[copyToClipboard]
other = "Копировать в буфер обмена"

[cookieconsentMessage]
other = "Этот сайт использует Cookies для улучшения вашего опыта."

[cookieconsentDismiss]
other = "Согласен"

[cookieconsentLink]
other = "Учить больше"
# === partials/assets.html ===

# === partials/plugin/share.html ===
Expand Down
9 changes: 9 additions & 0 deletions i18n/sr.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,15 @@ other = "sr"

[copyToClipboard]
other = "Копирај на радну таблу"

[cookieconsentMessage]
other = "Ова веб локација користи Cookies да би побољшала ваше искуство."

[cookieconsentDismiss]
other = "Договорити се"

[cookieconsentLink]
other = "Сазнајте више"
# === partials/assets.html ===

# === partials/plugin/share.html ===
Expand Down
9 changes: 9 additions & 0 deletions i18n/zh-CN.toml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,15 @@ other = "lib/lunr/lunr.segmentit.js"

[copyToClipboard]
other = "复制到剪贴板"

[cookieconsentMessage]
other = "本网站使用 Cookies 来改善您的浏览体验."

[cookieconsentDismiss]
other = "同意"

[cookieconsentLink]
other = "了解更多"
# === partials/assets.html ===

# === partials/plugin/share.html ===
Expand Down
Loading

0 comments on commit 0a9ec97

Please sign in to comment.