diff --git a/docs/getting-started.md b/docs/getting-started.md index fcac49eb1..13d23a344 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -580,7 +580,7 @@ in your `mkdocs.yml`: ``` yaml extra: - disqus: 'mkdocs-material' + disqus: 'your-shortname' ``` The comments section is inserted on *every page, except the index page*. diff --git a/material/base.html b/material/base.html index a1650e0a2..428f38be6 100644 --- a/material/base.html +++ b/material/base.html @@ -154,8 +154,8 @@ {% endblock %} {% endblock %} {% block disqus %} - {% if config.extra.disqus and not page.is_homepage %} -

{{ lang.t("meta.comments") }}

+ {% if (config.extra.disqus and not page.is_homepage) or + (page and page.meta and page.meta.disqus) %} {% include "partials/integrations/disqus.html" %} {% endif %} {% endblock %} diff --git a/material/partials/integrations/disqus.html b/material/partials/integrations/disqus.html index 5f003ca41..666ca08c6 100644 --- a/material/partials/integrations/disqus.html +++ b/material/partials/integrations/disqus.html @@ -1,14 +1,21 @@ -
- +{% set disqus = config.extra.disqus %} +{% if page and page.meta and page.meta.disqus is string %} + {% set disqus = page.meta.disqus %} +{% endif %} +{% if disqus %} +

{{ lang.t("meta.comments") }}

+
+ +{% endif %} diff --git a/material/partials/toc.html b/material/partials/toc.html index f268ac0c6..482d67985 100644 --- a/material/partials/toc.html +++ b/material/partials/toc.html @@ -17,7 +17,11 @@ {% endif %} - {% if config.extra.disqus and not page.is_homepage %} + {% set disqus = config.extra.disqus %} + {% if page and page.meta and page.meta.disqus is string %} + {% set disqus = page.meta.disqus %} + {% endif %} + {% if disqus %}
  • {{ lang.t("meta.comments") }} diff --git a/src/base.html b/src/base.html index 092b6adc5..edefba325 100644 --- a/src/base.html +++ b/src/base.html @@ -288,8 +288,8 @@ {% block disqus %} - {% if config.extra.disqus and not page.is_homepage %} -

    {{ lang.t("meta.comments") }}

    + {% if (config.extra.disqus and not page.is_homepage) or + (page and page.meta and page.meta.disqus) %} {% include "partials/integrations/disqus.html" %} {% endif %} {% endblock %} diff --git a/src/partials/integrations/disqus.html b/src/partials/integrations/disqus.html index f8a458e29..1cdfec838 100644 --- a/src/partials/integrations/disqus.html +++ b/src/partials/integrations/disqus.html @@ -20,18 +20,27 @@ IN THE SOFTWARE. --> + +{% set disqus = config.extra.disqus %} +{% if page and page.meta and page.meta.disqus is string %} + {% set disqus = page.meta.disqus %} +{% endif %} + -
    - +{% if disqus %} +

    {{ lang.t("meta.comments") }}

    +
    + +{% endif %} diff --git a/src/partials/toc.html b/src/partials/toc.html index 5a37edf1c..7265119f3 100644 --- a/src/partials/toc.html +++ b/src/partials/toc.html @@ -55,7 +55,11 @@ {% endif %} - {% if config.extra.disqus and not page.is_homepage %} + {% set disqus = config.extra.disqus %} + {% if page and page.meta and page.meta.disqus is string %} + {% set disqus = page.meta.disqus %} + {% endif %} + {% if disqus %}