An open API service indexing awesome lists of open source software.

https://github.com/dpecos/mastodon-comments

Webcomponent that embeds a Mastodon's toot conversation in a HTML page
https://github.com/dpecos/mastodon-comments

comments mastodon webcomponent

Last synced: about 1 month ago
JSON representation

Webcomponent that embeds a Mastodon's toot conversation in a HTML page

Awesome Lists containing this project

README

        

# mastodon-comments

`mastodon-comments` is a [webcomponent](https://developer.mozilla.org/en-US/docs/Web/API/Web_Components) that will embed a Mastodon's toot conversation in a website.

This webcomponent is explained in detail in the [following blog post](https://danielpecos.com/2022/12/25/mastodon-as-comment-system-for-your-static-blog/), where you can see a live example as well.

## Characteristics

- Implemented as a standard web component, easy to integrate
- Lazy-loads the toot conversation, only when the component is part of the viewport

## Styling the component

These are the default values that the component exposes as CSS vars (no need to specify them if you are happy with the current values):

```css
mastodon-comments {
--font-color: #5d686f;
--font-size: 1.0rem;

--block-border-width: 1px;
--block-border-radius: 3px;
--block-border-color: #ededf0;
--block-background-color: #f7f8f8;

--comment-indent: 40px;
--comment-padding: 20px;
}
```

## Example

Include the following lines in the head of your HTML:

```html

```

then just use `mastodon-comments` tag to point to the appropiate mastodon toot as shown below:

```html

```

You can see a full example here: [Example embedding a toot into a HTML](./example/index.html)

![mastodon-comments](./docs/mastodon-comments.png)