MarkdownMaster CMS Logo

Extra - Mastodon Comments

Adds page comments using a Mastodon post as a source.

Pages will not automatically have comments enabled, so once you publish a page you will need to publish a new post on your Fediverse / Mastodon account, (or with a branded account), on the server configured in the plugin configuration.

When you make a post, include a link to the page, some '#' tags about the content, and ideally a callback to ask for feedback or comments to boost engagement.

The ID will be visible in the URL of the post, ie: on a post https://social.veraciousnetwork.com/deck/@cdp1337/114594237700425231 the ID is 114594237700425231.

Copy this ID to the newly published page in the Frontmatter and ensure to wrap the ID in quotes (single or double).


--- ... fediverse: '114594237700425231' ---

Initialization

To load this plugin from the theme:

<script>
    CMS.loadExtra('mastodon-comments', {'host': 'your-mastodon-instance'});
</script>

Configuration

  • host - The hostname of your Mastodon instance.
  • styles - Optionally set this to false to disable default styles.

Required Schema

Pages must have a fediverse attribute to enable this feature on the individual pages.

(Note, the theme may override this attribute with a different attribute name, so refer to your theme documentation).

Usage

Inside the page/post layout template:

<% if(data.fediverse) { %>
    <section class="post-comments">
        <h2>Comments</h2>

        <mastodon-comments post-id="<%= data.fediverse %>"></mastodon-comments>
    </section>
<% } %>

Example Styles

Refer to mastodon-comments.css for default styles.

Source

Based off code published by Carl Schwan