############################# Feeding ABlog to Social Media ############################# `@nabobalis`_ released my contributions to `ABlog`_ to support automatic social media posts for new posts. I started evaluating how to automate posting new blog posts to social media. There are tons of services for doing this from syndication feeds, and some of them even have a limited "freemium" level, but the whole "social marketing" thing makes my skin crawl (even if that's essentially what I am trying to accomplish here) and I didn't want to have to think about those limits. I went looking for more "open" solutions though an external service. I still want to use an external service just because doing something self-hosted seems overkill especially after `I've just moved to a static site`_ generated, and hosted through an external service. I do like the "feeling" of `IFTTT`_, though there's no basis for that, I've done no research into their ethics and/or business practices. They offer a `syndication feed service`_ and `a tweet action`_ so I started playing around with that. Quick IFTTT gotcha, the web and Android app UIs report no activity for *checking* the feed, only once a new entry has been found in the feed. I wasted some time trying to figure out why it wasn't checking my feed before I'd made a new post. Beyond that it was dead simple to get working but `the resulting tweet`_ wasn't so great. The broken image is easy to fix just by changing the IFTTT action to the one without an image, but the lack of hashtags is a larger problem. The `Atom feeds generated by ABlog`_ didn't include any Atom entry ``category`` elements so there was no representation of `the ABlog tags`_ available in those feeds. I contributed `a PR to include category elements`_ for ABlog tags. A shout out to the maintainer, `@nabobalis`_, for being Johnny on the spot reviewing and merging my PRs quickly and without much fuss! That was a quick and easy contribution but the IFTTT `syndication feed service`_ only offers a small subset of `the Atom entry data`_ so I can't use the ``category`` elements there at any rate. Thinking about the right place/level to support getting `ABlog`_ post tags into tweet hashtags, I figured the best way to define the problem is as external services using syndication feeds as a sort of API to content. I can imagine many more such cases where external services support only a small subset of Atom feed entry data, or are very opinionated or inflexible about whats in the entry content, etc.. So I decided the best way to support as many of these use cases as reasonable was to generating multiple Atom feeds with support for using templates to render the values for the appropriate entry elements for each feed. As such, I could keep the default ABlog ``**/atom.xml`` feeds which do a fine job for the original purposes of syndication feeds, but add ``**/social.xml`` feeds whose entry contents represents what should be in each tweet, including hashtags. `Sphinx uses Jinja`_ internally, so that's what I used in a new `ABlog project configuration option`_. My `feed templates PR`_ was again promptly `reviewed, merged and released`_ by `@nabobalis`_. They even stepped in and fixed a CI issue exposed by my changes for me! I'd act surprised that I managed to turn something like this into a minor software project, but that would be lying. ;-) I wonder how the tweet for this post will look... .. _`ABlog`: https://ablog.readthedocs.io/ .. _`Atom feeds generated by ABlog`: https://ablog.readthedocs.io/manual/ablog-configuration-options/#blog-feeds .. _`the ABlog tags`: https://ablog.readthedocs.io/manual/posting-and-listing/#posting-with-a-directive .. _`a PR to include category elements`: https://github.com/sunpy/ablog/pull/92 .. _`@nabobalis`: https://twitter.com/nabobalis .. _`Sphinx uses Jinja`: https://www.sphinx-doc.org/en/master/templating.html#jinja-sphinx-templating-primer .. _`ABlog project configuration option`: https://ablog.readthedocs.io/manual/ablog-configuration-options/#confval-blog_feed_templates .. _`feed templates PR`: https://github.com/sunpy/ablog/pull/93#issue-597401522 .. _`reviewed, merged and released`: https://ablog.readthedocs.io/release/ablog-v0.10-released/#ablog-v0-10-14-released .. _`IFTTT`: https://ifttt.com/ .. _`syndication feed service`: https://ifttt.com/feed .. _`a tweet action`: https://ifttt.com/twitter .. _`the Atom entry data`: https://tools.ietf.org/html/rfc4287#section-4.2 .. _`I've just moved to a static site`: ../migrating-from-plone-to-ablog/ .. _`the resulting tweet`: https://twitter.com/rosspatterson/status/1373017010985185283 .. meta:: :description: Made some contributions to ABlog to support automatic social media posts for new posts. :keywords: ABlog, Syndication, Atom, IFTTT .. post:: Mar 22, 2021 :author: Ross Patterson :tags: ABlog, Syndication, Atom, IFTTT