Skip to content

How to disable the integrated Comment system? #70

Closed Answered by Mara-Li
andrey-jef asked this question in Q&A — Plugin
Discussion options

You must be logged in to vote

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 function value_in_frontmatter :

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 …

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@andrey-jef
Comment options

Comment options

You must be logged in to vote
1 reply
@Mara-Li
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by andrey-jef
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ Enhancement New feature or request 📫 Material Mkdocs Template Discussion about the mkdocs template
2 participants