Skip to content
This repository has been archived by the owner on Jun 4, 2022. It is now read-only.

Commit

Permalink
Merge pull request #278 from marcofranssen/feature/cookie-consent
Browse files Browse the repository at this point in the history
Add cookie consent to theme using config
  • Loading branch information
ppoffice committed Apr 9, 2020
2 parents bcf754d + 749ac8f commit 2c245bb
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions _config.yml.example
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ plugins:
on: # enter true to enable statcounter
mathjax: false # options: true, false
counter: false # for post words count and time of reading, need hexo-wordcount: https://github.com/willin/hexo-wordcount
cookie_consent: false

# Miscellaneous
miscellaneous:
Expand Down
21 changes: 21 additions & 0 deletions layout/plugin/scripts.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
<% if (theme.plugins.baidu_analytics) { %>
<%- partial('plugin/baidu-analytics') %>
<% } %>
<% if (theme.plugins.cookie_consent) { %>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/cookieconsent@3/build/cookieconsent.min.css" />
<% } %>
<% } else if (typeof(isFooter) !== 'undefined' && isFooter) { %>
<% if (theme.plugins.statcounter && theme.plugins.statcounter.on) { %>
<%- partial('plugin/statcounter') %>
Expand Down Expand Up @@ -40,4 +43,22 @@
<% if (theme.plugins.google_adsense && theme.plugins.google_adsense.publisher_id) { %>
<%- partial('plugin/google-adsense') %>
<% } %>
<% if (theme.plugins.cookie_consent) { %>
<script src="https://cdn.jsdelivr.net/npm/cookieconsent@3/build/cookieconsent.min.js" data-cfasync="false"></script>
<script>
window.cookieconsent.initialise({
"palette": {
"popup": {
"background": "#f0f0f0",
"text": "#777777"
},
"button": {
"background": "#82b965",
"text": "#ffffff"
}
},
"theme": "edgeless"
});
</script>
<% } %>
<% } %>

0 comments on commit 2c245bb

Please sign in to comment.