Adding ActivityPub Feed to my Website

I want to display a feed of my short form ActivityPub Notes on my website’s homepage. Is there any programatically accessible feed that I could fetch (either on the front end via JS, or via custom theme code) so I can write some code to render the feed of notes on my site? Or what is the easiest way to achieve getting my shortform posts to display on my homepage, without requiring people to find me via an ActivityPub client in order to see my shortform posts?

3 Likes

There is no official method to do this yet.

@Cathy_Sarisky has recently demonstrated that it’s possible on her blog though:

The posts/notes are all public in /.ghost/activitypub/outbox/index

2 Likes

I just made a quick PoC to show AP Notes embedded on a page by just using client-side code. Here is a running demo: https://codepen.io/muratcorlu/pen/PwPaGqg

You can try with your own Ghost URL.

I can spend more time to make this an easy to use component inside HTML cards or templates in Ghost.

3 Likes

Very nice! The reason I was using a cloud function for mine was that I wanted like and repost data, and didn’t seem to be able to get it otherwise. Do you see a way that I’m missing to get likes & reposts? It’d absolutely be better as a client-side function than needing a cloud function, but it’s supposed to be social web, so… ?

Yeah, I couldn’t come to that point yet. But I think it’s still valuable to show latests notes on our site, with a practical call to follow us on fediverse, even without like/comment numbers.

Ghost Admin fetches our own feed by calling /.ghost/activitypub/v1/posts/me endpoint which required Ghost Admin privileges. Maybe Ghost Team consider to make a similar endpoint that can work with Content API key.

I think the problem about like/comment counts is they change very quickly and it’s not easy to cache them. But we can improve this in time :blush:

1 Like

Maybe I should share this in a another topic but since this effort started in this thread, I wanted to give update here first:

I released a simple version: GitHub - synapsmedia/ghost-activitypub-embed: Web component to display ActivityPub feeds from Ghost blogs

If you want to try it, you can just create a page on Ghost and add an HTML card with this content:

<script src="https://cdn.jsdelivr.net/npm/@synapsmedia/ghost-activitypub-embed@0/ghap-embed.min.js"></script>

<ghost-activitypub-embed></ghost-activitypub-embed>

And here a working example on my blog: Murat Çorlu on Fediverse

Keep in mind:

  • This only shows your short-form notes, not the articles that are automatically shared.
  • Currently it doesn’t show re-posts, like and comment counts. There is nothing interactive.

I think next steps will be:

  • Customisation via CSS should be fine tuned and documented. This is not an iframe, so you can adapt to your theme very well.
  • Guiding visitors about following on Fediverse. Maybe a button that opens a dilaog with the information…
  • Show older notes, like with a load more button or an infinite scroll.
  • Checking the possibility to show re-posted notes.
  • Checking the possibility of showing like and reply counts.

I’m open for feedbacks, ideas and of course contributions. :blush:

3 Likes

@Cathy_Sarisky Great work! Have you shared your code anywhere? I’d like to hack on it a bit.

Sure @localjo - here ya go: GitHub - cathysarisky/api-with-activitypub

If you improve it, please share! :slight_smile:

I proposed this a while ago, it mirrors the same need.

I would love see a feature like this though: A simple checkbox (x) in the Notes compose overlay to publish an AP note to my own blog would go a long way in this regard.