Tag Archives: plugin

Make Feedly Notice an Updated WordPress Post by Changing the GUID

Sometimes it’s better to update an existing post than to write a new one. Maybe there’s an ongoing conversation in the comments thread, or news is breaking over the course of a day. Sometimes I’ll post a poll, then reuse the same post for the results, to keep discussion together. The problem is that not everyone will get the notice that the article has changed.

After posting a question on Feedly’s Google+ page, I confirmed that Feedly (and no doubt other readers) uses the post GUID to decide whether to fetch content. If it’s seen the GUID before, it assumes it’s already seen the content, and stops looking at it.

If you’ve never delved into RSS markup, you’ve probably never noticed this field, but the GUID is a “generally unique identifier” used to tell feed readers whether they’ve seen an article before. A new GUID means a new post. Most of the time, you don’t want that to happen, because you don’t want it adding the same post over and over again every time you fix a typo or change a headline.

Under limited circumstances, though, it might make sense to tell reader software that the updated post is a new one.

A StackExchange post pointed me to a filter hook that can be used to change the GUID. WordPress uses the ID-style permalink by default, because it should be unique, but it’s important to remember that the field is only an ID, and isn’t used as a link — so you can modify it without worrying about it staying a valid URL.

The response suggested to just append the modification date, but I didn’t want to do that. I frequently update old posts to fix typos, update links, remove dead links, etc. So instead, I added a custom field that I can fill out when I make a big enough change that I want the post to show up as new again.

// Modify the GUID in the RSS feed after major revisions (but not after every
// little change) so that clients like Feedly will pull the updated content.
function ktv_feed_guid_revisions($content) {
	$revised = get_post_meta( get_the_ID(), 'updated', true );
	if ($revised != "") {
		$content .= "?updated=$revised";
	}
	return $content;
}
add_filter('get_the_guid', 'ktv_feed_guid_revisions', 7);

I’ve got it in a functionality plugin for now. When I make a change that I really want to update everywhere, I add a custom field called “updated” and give it a value – usually a number, so that I can add to it if I have something that I update more than once while it’s still new enough to show up in feeds.

I wrote this months ago, but never got around to publishing it. Yesterday’s 10 ways to optimize your feed for feedly reminded me it was still sitting in my drafts, so I dusted it off.

New Plugin: Nice Links for Twitter Tools

Lately I’ve been linkblogging via Twitter, and using Alex King’s Twitter Tools to build a weekly digest in WordPress. The problem is that since I’m pulling the posts from Twitter, I’m stuck with Twitter’s limitations: Short descriptions, cryptic URLs, and unreadable links.

So I wrote a plugin to process the links. When Twitter Tools builds a digest, the plugin calls out to the remote site, follows redirects, retrieves the final URL and (if possible) extracts the page title. Then it replaces the cryptic-looking link with a human-readable link, transforming this:

Check out this site: http://bit.ly/9MhKVv

into this:

Check out this site: Flash: Those Who Ride the Lightning

If it can’t retrieve a title, it uses the final hostname. If it can’t connect at all, it leaves the link unchanged.

The download is here, and that’s where I’ll put future versions:
» Plugin: Twitter Tools – Nice Links.

Future

One thing I’d like to add at some point is cleaning up the title a bit. They can get really long, even without people trying to stuff keywords and descriptions in for SEO purposes. All it takes is a page title plus a site title, like this one. That’s a much more complicated problem, though, since there isn’t any sort of standard for which part of a title is the most important. I suppose I could just clip it to the first few words.

I’d also like to clean up duplicate text. Often the link title and tweet content are going to be the same, or at least overlap, especially if it’s generated by a sharing button or extension. That should be easier to check.

Promoting Old Posts

Weblog Tools Collection recently spotlighted a WordPress plugin to automatically tweet old posts. It seems like a good way to bring attention to a site’s archives, as long as it’s used sparingly. The frequency can be as high as once an hour, which IMO is a good way to lose all your followers, but one post every few days seems like it might be reasonable and even interesting.

I’ve already got a setup in place to show a “flashback” post on the front page, but most of the blog’s traffic seems to come from searches these days. Every once in a while I’ll happen to look at the front myself and say, “Oh, yeah, that was a good one!” and post a link on Twitter or Facebook.

This new plugin posts automatically, and picks an article at random. That’s helpful, because it can find old posts that I’ve forgotten. On the downside, because it’s random, there’s no quality control. It could just as easily pull out something completely inane that was funny for about a week five years ago as it could dredge up a forgotten gem. And there’s always the risk of promoting “Happy New Year!” in August — which is exactly what happened when I tested it on Speed Force.

You can filter out categories, but I think it might be more useful to filter on tags. Sure, it can take a while to go through the archives tagging posts that you feel are worth a second look, but it would certainly improve the signal/noise ratio with this scheme. Even better, there’s a lot more you can do once you’ve tagged your “classics.” Highlight them on archive pages, list some of them in the sidebar, build an index, etc.

Hmm, this might be an interesting project at some point.

Update (August 23): Well, I’ve disabled this for now — on both blogs — because of the lack of control. I’d rather forget to post “Hey, remember this?” than have it clutter up people’s accounts with old linkblogging digests or something similarly pointless. When I have time, I should work on that classics project, both tagging posts and hacking on the plugin.

Quick Fix: WordPress Social Homes and LinkedIn Icon

The Social Homes plugin for WordPress displays a list of icons linking to your various social networking profiles* as a sidebar widget. When you update your list of sites, it calls out and automatically detects the location of each icon.

Unfortunately, the detection doesn’t work on LinkedIn, leaving your blog with a broken image, empty square or text label, depending on the visitor’s web browser. The plugin developer is aware of the issue, but several months have gone by with no fix.

So I’ve fixed it. Here’s how you can fix it on your blog.

Technical Details

First, some background. The problem is that Social Homes is expecting to see this pattern:

<link rel="shortcut icon" href="/path-to-icon">

But LinkedIn is using this equally valid pattern:

<link href="/path-to-icon" rel="shortcut icon">

This would be okay if it simply failed to find the icon, because it would fall back to /favicon.ico … which happens to be correct for LinkedIn. Instead it’s skipping past the end of the tag and picking up the next reference, which is currently a stylesheet.

The Fix

The simplest fix** is to just make sure it stops at the end of the tag, and let it fall back to favicon.ico.

Here’s what to do. Open up social-homes.php and look for the section titled, “Social Homes service parser.” The function you want is called widget_socialhomes_parse_service

Look for the section labeled, “grab the favicon” and find these two lines:

$tmpIcon1 = split('"shortcut icon"', $contents);
$tmpIcon2 = split('href="', $tmpIcon1[0]);

Add the middle line below, and change tmpIcon1[1] to tmpIcon1a[1] in what’s now the third line:

$tmpIcon1 = split('"shortcut icon"', $contents);
$tmpIcon1a = split('>', $tmpIcon1[1]);
$tmpIcon2 = split('href="', $tmpIcon1a[0]);

That’s it! All you have to do now is go back into your Widgets config, open up the Social Homes widget, and re-save it!

*Technically, you can link to any website, whether it’s a social networking profile or not, but that’s the original intent.

**A more proper fix would be to change the way Social Homes looks for the icon so that it doesn’t depend on the link attributes being in the same order, but this is a simpler change.

Check Your Plugins!

It’s a safe bet that your web browser uses at least one plugin, and probably several. Maybe it’s just Flash for viewing animations and video (think YouTube and Hulu). Maybe it’s Silverlight for watching Netflix, or Shockwave for playing games. You’ve probably got Java installed.

Just like your web browser, these plugins must be kept up to date or you’ll run into problems: missing features, instability, or (worst case) security vulnerabilities. Unfortunately, most plugins don’t update themselves.

Several months ago, Mozilla introduced a service called Plugin Check that will identify the plugins you have installed and tell you whether they need to be updated — and how to do it. At first it only worked on Firefox, but now it’s been expanded to all major browsers: Chrome, Safari, Opera, and even Internet Explorer.

It’s worth taking a few moments to check. Think of it as a pit stop for your computer’s web browser.