11ty / eleventy-base-blog

A starter repository for a blog web site using the Eleventy static site generator.
https://demo-base-blog.11ty.dev/
MIT License
1.23k stars 619 forks source link

Auto posting to social media #143

Open rdela opened 1 year ago

rdela commented 1 year ago

If one wanted to auto post one's new screeds to say, Mastodon, how would one go about that?

I am looking for the equivalent to this in Eleventy land https://github.com/janboddez/share-on-mastodon

rdela commented 1 year ago

An option: Zapier - RSS to Mastodon https://community.zapier.com/code-webhooks-52/rss-to-mastodon-19131

You have first to create an application on Mastodon in your Developper section, for example

https://mastodon.social/settings/applications

Add the necessary information (url is https://zapier.com), then uncheck all the boxes already checked, and check write:statuses to publish statuses on Mastodon.

Then create the Webhook in your Zap, with:

URL : https://mastodon.social/api/v1/statuses?access_token=XXX : change the .social depending on your Mastodon account. The token is in your Mastodon app Data : put “status” and add the Post Title / Post Link…

rdela commented 1 year ago

On Zapier forum link in prev comment:

FYI, this additional article helped me to actually get it working!

https://lukas.io/page:2

better link https://lukas.io/autoposting-rss-to-mastodon

bennypowers commented 1 year ago

I accomplished this with the webmentions netlify plugin and bridgy

eleventyConfig.addGlobalData('isProductionBuild', process.env.NETLIFY && process.env.CONTEXT === 'production');

Since I'm scanning the feed each time I build, I need to include the mention inside the post content

<div class="e-content">
  <template webc:nokeep @raw="content"></template>
  <a id="tldr"
     webc:if="watch || isProductionBuild"
     href="https://brid.gy/publish/mastodon"></a>
</div>