diff --git a/_config.yml b/_config.yml index 85878cc..98e68aa 100644 --- a/_config.yml +++ b/_config.yml @@ -741,9 +741,12 @@ isso: # # See: https://theme-next.js.org/docs/third-party-services/post-widgets # --------------------------------------------------------------- -# AddThis Share. See: https://www.addthis.com -# Go to https://www.addthis.com/dashboard to customize your tools. -add_this_id: +# AddToAny Share. See: https://www.addtoany.com +addtoany: + enable: false + buttons: + - facebook + - twitter # --------------------------------------------------------------- diff --git a/layout/_partials/post/post-share.njk b/layout/_partials/post/post-share.njk index 0f2148f..edd4bff 100644 --- a/layout/_partials/post/post-share.njk +++ b/layout/_partials/post/post-share.njk @@ -3,3 +3,12 @@ {%- endif %} + +{%- if theme.addtoany.enable %} +
+ + {%- for button in theme.addtoany.buttons %} + + {%- endfor %} +
+{%- endif %} diff --git a/layout/_third-party/addtoany.njk b/layout/_third-party/addtoany.njk new file mode 100644 index 0000000..cbfa521 --- /dev/null +++ b/layout/_third-party/addtoany.njk @@ -0,0 +1,3 @@ +{%- if theme.addtoany.enable %} + {{ next_js('third-party/addtoany.js') }} +{%- endif %} diff --git a/layout/_third-party/index.njk b/layout/_third-party/index.njk index b82ec34..f568e59 100644 --- a/layout/_third-party/index.njk +++ b/layout/_third-party/index.njk @@ -16,5 +16,5 @@ {%- include 'tags/mermaid.njk' -%} {%- include 'fancybox.njk' -%} - {%- include 'pace.njk' -%} +{%- include 'addtoany.njk' -%} diff --git a/source/css/_common/components/post/post-widgets.styl b/source/css/_common/components/post/post-widgets.styl index 346f555..34c7afb 100644 --- a/source/css/_common/components/post/post-widgets.styl +++ b/source/css/_common/components/post/post-widgets.styl @@ -3,5 +3,9 @@ font-size: $font-size-small; margin-top: 1em; padding-top: 1em; - text-align: center; + flex-wrap(); + + a { + border-bottom: none; + } } diff --git a/source/js/third-party/addtoany.js b/source/js/third-party/addtoany.js new file mode 100644 index 0000000..f9009f8 --- /dev/null +++ b/source/js/third-party/addtoany.js @@ -0,0 +1,8 @@ +/* global NexT */ + +document.addEventListener('page:loaded', () => { + NexT.utils.getScript('https://static.addtoany.com/menu/page.js', { condition: window.a2a }) + .then(() => { + window.a2a.init(); + }); +});