Skip to content

Commit

Permalink
updated to embed using
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisfarnham committed Apr 9, 2024
1 parent 7c16946 commit 848e8b6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ Embed a Post and Its Replies
You can also embed an individual post, the replies to a post, or both.
This mode lets you use Fediverse replies as a comment system for static sites, inspired by [a blog post from Carl Schwan][reply-post].

Use this to embed a post:
Use this to embed a post along with its responses:

<a class="mastodon-post-and-replies"
<a class="mastodon-thread"
href="https://mastodon.social/@Mastodon"
data-toot-id="112011697087209298"
>Post and replies from the Fediverse</a>
>Thread from the Fediverse</a>

By default, both the original post and the replies appear.
You can customize this link with `data-` attributes:
Expand Down
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ <h1><a href="https://github.com/sampsyo/emfed">Emfed</a></h1>
href="https://esm.sh/emfed@1/toots.css"></pre>

<p>Alternatively, you can embed a single post along with its replies:</p>
<pre>&lt;a class="mastodon-post-and-replies"
<pre>&lt;a class="mastodon-thread"
href="https://mastodon.social/@Mastodon"
data-toot-id="112011697087209298"
>replies to my toot&lt;/a></pre>
>Single toot and its replies&lt;/a></pre>
<p>One place you can see Emfed in action is at the
<a href="https://beets.io">beets project</a>.
The <a href="https://github.com/sampsyo/emfed">code</a> is
Expand Down
2 changes: 1 addition & 1 deletion src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,6 @@ export async function loadTootPostAndReplies(element: Element) {
export function loadAll() {
document.querySelectorAll("a.mastodon-feed").forEach(loadToots);
/* inspired by https://carlschwan.eu/2020/12/29/adding-comments-to-your-static-blog-with-mastodon/ */
document.querySelectorAll("a.mastodon-post-and-replies").forEach(loadTootPostAndReplies)
document.querySelectorAll("a.mastodon-thread").forEach(loadTootPostAndReplies)

}

0 comments on commit 848e8b6

Please sign in to comment.