Git Product home page Git Product logo

fediverse's Introduction

Fediverse

A Pelican plugin to publish content on the Fediverse

⚠️ Under development. Presently only Mastodon is supported. DEVELOPERS NEEDED!

Hacked from Pelican-tweet.

⚠️ Needs Python > 3.0

How it works (Mastodon)

Fediverse will search your contents for articles (actually ALL contents except pages) that are not in a draft status.

On its first run it creates a file called posted_on_Mastodon.txt in your Pelican root directory populated with all your article URLs.

Then it tries to post all eligible articles to Mastodon and - if post routine returns no errors - writes posted article URLs in posted_on_Mastodon.txt.

On every further run it matches the actual articles list with the list in posted_on_Mastodon.txt file and posts only new articles (and writes them in posted_on_Mastodon.txt).

Fediverse is at its very first stage of development, but it is already usable in product environments.

This release can publish:

  • Title of article
  • Body of article
  • hashtag(s) if any

Title is taken from article.title

Body is taken from article.summary with standard Pelican configuartion i.e. length trimmed to 50 words and summary ends with ... OR with parameters you set in pelicanconf.py (SUMMARY_MAX_LENGTH and SUMMARY_END_SUFFIX).

If the total length of the post exceeds MAX length allowed from Mastodon, then Fediverse will trim article.summary accordingly.

Hashtag(s) are taken - if any - from article.tags and concatenated separating each of them with commas.

Pelican can nicely handle tags with whitespaces (for example #My nice article) but in Mastodon they must be written without. For this reason all whitespaces from Pelican hashtags will be removed before publishing (#Mynicearticle).

Mastodon APIs

This plugin depends on Mastodon.py.

In order to publish on Mastodon you need to enter in publishconf.py the following information:

MASTODON_BASE_URL = 'URL of your Mastodon instance. For example https://mastodon.social'
MASTODON_USERNAME = 'Your username for Mastodon login'
MASTODON_PASSWORD = 'You password for Mastodon login'

There is no need to register an app in your Mastodon profile because Fediverse will do it for you!

On every run Fediverse looks for a file called pelicanfediverse_clientcred.secret and - if it is not found - it gets in touch with Mastodon, creates an app called PelicanFediverse and writes API keys and other necessary information in this file.

If you cancel this file Fediverse will create another app on its next run (this could be done in case of problem despite the fact Mastodon advise this is NOT a good behaviour since app should be created only once).

fediverse's People

Contributors

mpaglia0 avatar

Stargazers

 avatar

Watchers

 avatar

fediverse's Issues

Comment Display Option

Hey there, I was looking to add something like this as a custom plugin but I'm thrilled to see this! I built the custom emoji plugin for Pelican, and I'd be happy to work on more for this.

I recentlyish stumbled across this post about adding Fediverse comments to your blog, which is something that'd pair really nicely with an auto-post system.

Would there be interest in a comments templating system as part of this plugin, to allow someone to add it to their article templates to render if there's a relevant URL?

I'd also like to work on options for the post system to allow it to only upload newer posts. I'll create an enhancement project and branch to add it if so!

Feature Request

This is exactly something that I have been looking for.

There are a couple of features that I would love to see in future releases (and if I find time to hack-away I will add a pull-request), they are:

  • prevent unlisted posts from the list (maybe its there)
  • Prevent categories (or whitelist categories)
  • select post type to mastodon: public, unlisted, local
  • upload an image with the post, if an image isn't available include a "default" - I use pelican-photos and it could be that, or it could be the social graph image (probably harder)
  • Use API keys vs username/psw in the config file.
  • Update readme for install instructions.

When I get some testing/playing time I will try to knock a couple off this list.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.