Microblogging for Pelican
MIT License
A Pelican plugin providing "microblogging" capabilities.
.. image:: https://img.shields.io/pypi/v/minchin.pelican.readers.microblog.svg?style=flat :target: https://pypi.python.org/pypi/minchin.pelican.readers.microblog/ :alt: PyPI version number
.. image:: https://img.shields.io/badge/-Changelog-success :target: https://github.com/MinchinWeb/minchin.pelican.readers.microblog/blob/master/CHANGELOG.rst :alt: Changelog
.. image:: https://img.shields.io/pypi/pyversions/minchin.pelican.readers.microblog?style=flat :target: https://pypi.python.org/pypi/minchin.pelican.readers.microblog/ :alt: Supported Python version
.. image:: https://img.shields.io/pypi/l/minchin.pelican.readers.microblog.svg?style=flat&color=green :target: https://github.com/MinchinWeb/minchin.pelican.readers.microblog/blob/master/LICENSE.txt :alt: License
.. image:: https://img.shields.io/pypi/dm/minchin.pelican.readers.microblog.svg?style=flat :target: https://pypi.python.org/pypi/minchin.pelican.readers.microblog/ :alt: Download Count
pip install minchin.pelican.readers.microblogging
micro
folder in your content folder (to hold your micro blogmicro
folder. This can be generally be justtitle
is unneededslug
will be auto-generated (based on the post date), anddate
will determined from the file creation datetime of the post file.date
, it must be on the first line, in key: value
.. code-block:: md
date: 2023-07-09 17:01
I'm microblogging with Pelican! https://blog.minchin.ca/label/microblogging-pelican
Or a post with an image:
.. code-block:: md
date: 2023-07-11 21:38 image: images/birger-strahl-olI66vtMgNo-unsplash.jpg
Microblog posts can have "feature" images too! (URL of photo should automatically be added.)
The image path is relative to your content
folder. A URL of the photo is
added to the end of the post as well.
Or with tags (or hashtags):
.. code-block:: md
date: 2023-07-13 14:56 tags: Python, Pelican, Microblogging
I'm now Microblogging with Pelican!
This will add links at the end of your post to the tags to the tag page for your (Pelican) site.
For now, it does not pull tags out of the body of your post.
Microblogging is here considered to be blog posts, but very short in length.
The most common example is Twitter, with an original limit of 140 characters
(to be less than the SMS max of 160 characters). Twitter has since doubled
their limit to 280 characters. The default on Mastodon is 500 characters, the
same as (newly released) Threads. (Note that on Twitter, all links are run
through a shortener and so are considered 23 characters long.) Here, the
default soft limit is 140 characters. You can choose to ignore that, or set a
higher limit (via MICROBLOG_MAX_LENGTH
), but there are certain assumptions
about presentation that start to fail as the posts get longer....
The easiest way to installed Microblogging is through pip
:
.. code-block:: sh
pip install minchin.pelican.reader.microblog
Microblogging relies on Pelican, and the autoloader
plugin (for
autoloading). If this plugin is installed from PyPI, these should automatically
be installed.
if you need to insrall them manually:
.. code-block:: sh
pip install pelican pip install minchin.pelican.plugins.autoloader
.. Additional Images -----------------
Micro blog post, using the Seafoam theme:
(Placeholder image for the moment...)
.. image:: https://github.com/MinchinWeb/seafoam/raw/master/docs/screenshots/2.6.0/article_with_header.png
:align: center
:alt: Replace Image...
These settings can be set in your pelicanconf.py
file (your Pelican settings
file) to alter the behavior of the plugin.
If a value is given below, this represents the effective default value. If no
value is given, the effective default value is None
.
Microblogging also auto-configures itself when possible. If you need to manually create the default configuration, you would need the following:
.. code-block:: python
PLUGINS = [ "minchin.pelican.readers.microblog", # others, as desired... ]
This documentation has to be manually updated. If the settings no longer match
the plugin's behavior, or a setting is missing from here, please open a ticket
on GitHub <https://github.com/MinchinWeb/minchin.pelican.readers.microblog/issues>
_.
.. use the ".. data::" directive here for Sphinx output, but on GitHub, that just causes everything to disappear
ARTICLE_ORDER_BY = "reverse-date"
Sorting order for micro blog posts (also used for sorting posts generally);
micro posts will be sorted among all posts. (Regular Pelican setting)
AUTHOR
Default author for micro blog posts. Can be overwritten by the metadata at
the top of individual posts. (Regular Pelican setting; you don't have to
supply an author.)
MICROBLOG_APPEND_HASHTAGS = True
Tags gets appended at the end of the micro blog post as hashtags.
#taggedyou Tags have the CSS class .microblog-post-tag
applied, if
you want to conditionally control their display or formatting.
MICROBLOG_CATEGORY = "µ"
Default category for your micro blog posts. It could be overwritten by the
metadata on top of individual posts.
Note that Pelican will render the slug (used in URLs) for this default as
m
.
MICROBLOG_FOLDER = "micro"
Folder containing your micro blog posts, relative to your content root
folder.
MICROBLOG_MAX_LENGTH = 140
How long should your micro blog posts be limited to. Pelican will emit a
warning if you exceed this.
MICROBLOG_SAVE_AS = ARTICLE_SAVE_AS
What to save the micro blog posts output file as. Defaults to using the same
file structure as you are using for articles (aka "regular" posts). c.f.
MICROBLOG_URL
.
MICROBLOG_SLUG = "u{date:%Y%m%d%H%M}"
The slug that will be used for micro blog posts. Eg. u202307091701
.
Note that Pelican expects slugs to be universally unique.
MICROBLOG_URL = ARTICLE_URL
What URL to post the micro blog posts to. Defaults to using the same URL
structure as you are using for articles (aka "regular" posts). c.f.
MICROBLOG_SAVE_AS
.
For best support, you will need to modify your theme, or select a theme that
already supports Microblogging, like my seafoam <http://blog.minchin.ca/label/seafoam/>
_.
Some helpful notes:
Articles
by Pelican, and will be includedarticles
and dates
"lists" provided by the templating engine.article.micro = True
.µ
category (by default).article.content
) in places that a link via the title of the article is.microblog-post-tag
applied..microblog-post-image
applied.Changelog <https://github.com/MinchinWeb/minchin.pelican.readers.microblog/blob/master/CHANGELOG.rst>
_
These are features that I would like to eventually add to the plugin (and the issues I'm using to track their progress):
Issue 1 <https://github.com/MinchinWeb/minchin.pelican.readers.microblog/issues/1>
_Issue 2 <https://github.com/MinchinWeb/minchin.pelican.readers.microblog/issues/2>
_Issue 3 <https://github.com/MinchinWeb/minchin.pelican.readers.microblog/issues/3>
_Issue 4 <https://github.com/MinchinWeb/minchin.pelican.readers.microblog/issues/4>
_Issue 5 <https://github.com/MinchinWeb/minchin.pelican.readers.microblog/issues/5>
_Issue 6 <https://github.com/MinchinWeb/minchin.pelican.readers.microblog/issues/6>
_Issue 7 <https://github.com/MinchinWeb/minchin.pelican.readers.microblog/issues/7>
_Pull Requests to implement any of these are welcomed!
SITE_URL
articles
list passed todates
instead (which is sorted by date)? -- Issue 8 <https://github.com/MinchinWeb/minchin.pelican.readers.microblog/issues/8>
_{filename}../regular-post.md
) crashes Pelican -- Issue 9 <https://github.com/MinchinWeb/minchin.pelican.readers.microblog/issues/9>
_str.removesuffix()
, which means this only supports Python 3.9 or.. Credits