Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Fediverse comments #1457

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pierreprinetti
Copy link

How to add Fediverse comments

In a post where to allow Fediverse comments:

comments:
  fediverse:
    url: https://example.com/@handle/123456789012345678

All replies to the Fediverse post will appear as comments.

Moderation

By default, the moderation system is opt-out. All replies will be published unless they are individually hidden.

To hide one specific Fediverse post:

comments:
  fediverse:
    url: https://example.com/@handle/123456789012345678
    hidden:
    - https://example.com/@troll/123456789012345679

To switch to opt-in moderation, where only accepted posts are shown:

comments:
  fediverse:
    url: https://example.com/@handle/123456789012345678
    moderation: opt-in
    shown:
    - https://example.com/@friend/123456789012345680

The JavaScript for the comments is based on yidhra's work, combined with Daniel Pecos Martinez's
work
for the Hugo version, as pupularized by Jan
Wildeboer
. It also includes changes by me.

What does this PR change? What problem does it solve?

This PR adds support for Fediverse comments. Any replies to the given Fediverse post will appear as comments under your Hugo article.

Was the change discussed in an issue or in the Discussions before?

No. This is code that I use on a PaperMod fork on my website and I am proposing it back upstream just in case maintainers are interested.

I am aware that this code can't be merged as-is as it currently fetches an external library from the Cloudflare CDN. If the maintainers are interested in the functionality, I am happy to vendor the library and make other required changes.

PR Checklist

  • This change adds/updates translations and I have used the template present here.
  • I have enabled maintainer edits for this PR.
  • I have verified that the code works as described/as intended.
  • This change adds a Social Icon which has a permissive license to use it.
  • This change does not include any CDN resources/links.
  • This change does not include any unrelated scripts such as bash and python scripts.
  • This change updates the overridden internal templates from HUGO's repository.

How to add Fediverse comments
=============================

In a post where to allow Fediverse comments:
```yaml
comments:
  fediverse:
    url: https://example.com/@handle/123456789012345678
```

All replies to the Fediverse post will appear as comments.

Moderation
==========

By default, the moderation system is opt-out. All replies will be
published unless they are individually hidden.

To hide one specific Fediverse post:
```yaml
comments:
  fediverse:
    url: https://example.com/@handle/123456789012345678
    hidden:
    - https://example.com/@troll/123456789012345679
```

To switch to opt-in moderation, where only accepted posts are shown:
```yaml
comments:
  fediverse:
    url: https://example.com/@handle/123456789012345678
    moderation: opt-in
    shown:
    - https://example.com/@friend/123456789012345680
```

The JavaScript for the comments is based on [yidhra's
work](https://yidhra.farm/tech/jekyll/2022/01/03/mastodon-comments-for-jekyll.html),
combined with [Daniel Pecos Martinez's
work](https://danielpecos.com/2022/12/25/mastodon-as-comment-system-for-your-static-blog/)
for the Hugo version, as pupularized by [Jan
Wildeboer](https://codeberg.org/jwildeboer/cayman-fedi). It also
includes changes by me.
Copy link

sonarcloud bot commented Mar 10, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

@shombando
Copy link

@pierreprinetti this is great, looking forward to this getting merged!

@adityatelange adityatelange added the ext-resources Uses external resources (js/css) from CDNs label Apr 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ext-resources Uses external resources (js/css) from CDNs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants