Friday, February 20, 2015

The joy of working with @IFTTT , @WordPressdotcom , and @Blogger

Bear with me for a while; I want to document something.


For a lot of reasons (mainly to see if I could do it), I decided a couple of weeks back that I would like to simulcast this blog (which runs on WordPress.com) onto the Blogger platform. My plan was to write and publish the blog posts on WordPress (whose editor I like better – the old one, not the new one) and use IFTTT to take the post from WordPress and create a post on my Blogger blog. So, I set up the blog on Blogger and created a recipe in IFTTT that waited for a new post on WordPress and publish it on Blogger as well.


And it worked!


To a point…


Some of the posts weren’t showing up in Blogger when I did this. I would get the post title and nothing else. I experimented and found that, whenever I attached a caption to a picture in WordPress (which I do frequently), I was getting the blank posts. I looked at the code WordPress was generating, and it looked like this:




<figure id=”attachment_1877″ style=”width: 375px;” class=”wp-caption aligncenter”><a href=”http://ift.tt/14zqt9v”><img src=”http://ift.tt/1B5uC3K&quot; alt=”Click to visit the challenge!” class=”size-full wp-image-1877″ /><figcaption class=”wp-caption-text”>Click to visit the challenge!</figcaption></figure>


Perfectly-formatted HTML5 code. Works on both WordPress and Blogger, provided it’s coded in the text editor of each. Unfortunately, when IFTTT processes the code, it inserts a line before all of that that looks like this:




<div xmlns=’http://www.w3.org/1999/xhtml’&gt;


That tells Blogger that what follows is XHTML. That <figure> tag, added as part of HTML5, is not allowed in XHTML. As a result, and I don’t know where it’s happening, the minute that tag is encountered, something is telling IFTTT “NOPE!” and everything except for the XHTML line is deleted from the post.


Now, just as an experiment, I set up a recipe that would look to Blogger and create a post in WordPress, and it worked fine. The HTML5 passes over with no problem, and everything is, as my Canadian friends say, tickety-boo. No tag that tells WordPress “Here comes XHTML!” is generated when going from Blogger to WordPress. But the exercise involves taking what’s in WordPress and sending it to Blogger, not the other way around.


So, until IFTTT figures out why they’re telling Blogger that XHTML is coming and stops doing it, I’m using an XHTML method to center graphics and put captions on them.


This is frustrating!!

The above image required the following code:




<div style=”width: 240px; margin-left: auto; margin-right: auto; display: block; text-align: center; font-size: 75%”><img src=”…” width=”240″ /> This is frustrating!!</div>


I have this all sitting in Evernote so I can copy and paste it whenever I need it, but man, it’s a pain in the backside to center a picture in a post and put a caption underneath in both WordPress and Blogger. I could just decide to get WordPress right and have Blogger show up however it shows up, but that’s not how I roll. I want to get it right on both platforms, and would like to get it right without having to go through all this.


I have alternatives, of course. One would be to use another service, but so far IFTTT is the only one that can work with WordPress and Blogger. I could go from Blogger to WordPress, but the Blogger editor doesn’t give me the ability to put a caption on a picture, among other things (e.g ordered and unordered lists). To get those things, I’d have to do the markup manually (i.e. what I’m doing now). I could code the posts offline using Markdown, post manually to both WordPress and Blogger, and take IFTTT out of the loop entirely, at least until they fix the problem. Or I could shut down the Blogger blog and forget the whole thing.


IFTTT is aware of the problem, and is “looking into it.” I guess I’ll find out when I find out. Meanwhile, if things look a little weird, we’re working on it.








from WordPress https://thesoundofonehandtyping.wordpress.com/2015/02/20/the-joy-of-working-with-ifttt-wordpressdotcom-and-blogger/

via IFTTT

No comments:

Post a Comment