How to disable the integrated Comment system? #70
-
Hi Mara, Following this tutorial from mkdocs-material, "you can enable comments on a page by setting the comments front matter property to true". I'm understanding that if the frontmatter does not included the However, in my recent try, the Comments section was always there (check screenshot below) Could you please teach me how to
I already read the tutorial to integrate the Comments in the plugin documentation site, but I could not find how to disable. At the moment, I incline to delete all the contents in the file Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Hello! You can disable it :
|
Beta Was this translation helpful? Give feedback.
-
@Lisandra-dev Nothing in haste, I'm just curious to consult the docs, compare the code and learn new things. Footnotes |
Beta Was this translation helpful? Give feedback.
-
Okay, it takes me some times but I successfully updated the method to add comments. First, I updated the python hooks file def value_in_frontmatter(key, metadata):
"""Check if a key exists in the frontmatter.
Args:
key (any): the key to check
metadata (any): the frontmatter
Returns:
bool: true if exists
"""
if key in metadata:
return metadata[key]
else:
return None and updated the on_env function : def on_env(env, config, files, **kwargs):
env.filters["value_in_frontmatter"] = value_in_frontmatter
return env In comments, I added this line before the comments block : {% set local_comments = "comments" | value_in_frontmatter(page.meta) %}
{% set comments = config.extra["comments"] if local_comments is none else local_comments %}
{% if comments %}
....
{% endif %} Following this, you need to add the key extra:
comments: true # or false This key allow to enable OR disable globally the comments.
|
Beta Was this translation helpful? Give feedback.
Okay, it takes me some times but I successfully updated the method to add comments.
First, I updated the python hooks file
on_env.py
because Jinja doesn't work as attended. I added the functionvalue_in_frontmatter
:and updated the on_env function :
In comments, I …