Simon Dickson has been blogging about online government, politics and WordPress since 2005. Some important people read it.

 
 

Archive for 'markpack'


Friday 28 September 2012

Syndicated sidebars

Rumours of the demise of RSS seem to come in waves. We're in the midst of another one just now, with moves by Twitter and Google (in the form of Feedburner) seemingly calling its future into question.

Before I began to bore everyone with the wonders of WordPress, I used to bore people with the wonders of RSS. In fact, it was WordPress's handling of RSS feeds which initially won my heart. Feeds are now so ingrained in my daily life, I don't even think about it any more. But the reality is, RSS reading (per se) didn't catch on.

That isn't so say that it's a dead technology though, far from it. Five years ago, I suggested Facebook 'might actually be the app which brings RSS to the masses'. Not too far off, as it turned out. I wonder how many people receive Facebook updates, or automated tweets, or email newsletters, which are really just renderings of an RSS feed?

And so to a little project I've been working on, in conjunction with leading Lib Dem blogger Mark Pack.

Mark wanted to recreate an application he used to manage whilst a full-time party employee: a javascript 'widget' to display political campaign buttons on other people's web pages. A simple 'ad server', if you will. Nothing too clever technically, but a nice idea well implemented. Sadly though, since Mark had moved on, it had 'fallen out of favour'.

Its successor is the new Lib Dem Widget, a curated collection of current political content and links, which - like its predecessor - can be added to any website with a single line of code.

<script type="text/javascript" src="http://libdemwidget.markpack.org.uk/"></script>

We pull in details of the latest party news item, the latest YouTube video, plus a collection of other interesting bits from around the web, and render it in a nicely style-guide-compliant 'skyscraper', which should drop seamlessly into any website sidebar. And yes, of course, it's (mostly) driven by RSS feeds.

You won't be surprised to learn we built it with WordPress: but it's a rather unusual use case. The widget runs as a theme, giving us easy access to:

  • WP's built-in feed-fetching;
  • its various caching options - including, but not limited to WP Super Cache; and
  • its oEmbed calls, for easy inclusion of the YouTube clip.

In effect, it's the 'homepage' of a one-page site... but a site with no actual content of its own.

To give things a visual lift, we also 'code scrape' the various linked pages, looking for details of thumbnail images. Facebook's OpenGraph meta tags are now in fairly widespread use, so there's a healthy chance that we'll see an og:image in the HTML header - and if so, we'll use that.

Writing code which will work on any website - regardless of sidebar width, existing CSS styles etc - has been quite a challenge. The markup ends up pretty ugly, with everything included 'inline', just to be sure. And even then, I'm not sure we've sorted out every possible use case... but that's what beta testing is there for.

Wednesday 22 December 2010

Puffbox launches site for Djibouti presidential candidate

A month or two ago, to be perfectly honest, I would have struggled to find Djibouti on a map. But for the last few weeks, I've been working on a project to launch one man's campaign to become its President: and the site went live this week.

Djibouti is a former French colony, located on the Horn of Africa, slightly larger than Wales, population well under a million. It's a key port for the region. It also shares a border with Somalia, sits across the water from Yemen, and is home to large French and American military bases. And it's having a Presidential election next year. The current incumbent won a second term in 2005, with a mere 100% majority; and this year, they changed the constitution to allow him to stand for a third term.

Djiboutian businessman Abdourahman Boreh has now declared himself an opposition candidate for next April's election; he is being represented by a London-based PR consultancy, MHP Communications, who brought me in to build a website for the campaign: not voter-facing as such, more as a resource to help establish his credentials internationally.

The site is built on WordPress: primarily pages rather than posts, at this early stage anyway. But significantly, it's in two languages - English and French, with a long-term possibility of adding Arabic. It soon became clear that fudging the multilingual functionality wouldn't work: so it's the first time I've used WPML, the leading WordPress plugin for content in more than one language.

To be perfectly frank, WPML has been a bit hit-and-miss. When it works, it's absolutely brilliant: but some things just haven't worked at all. I've had to deploy various workarounds, sometimes going as far as coding whole new plugins or widgets. And some features, even relatively run-of-the-mill things, I've simply had to drop. It's a great solution for multilingual content; but be prepared for some unpleasant side-effects.

The feature I'm most proud of is also language-related; but is something I've coded myself. We're inviting people to leave comments on most pages; and we're using a WPML meta-plugin to merge the comment threads between translations. In other words, if you leave a comment on the English version, it'll also appear at the bottom of the French version. But what if you don't speak the other language?

Thanks to Google's translation API, and a bit of jQuery, you can click on a link under each comment to translate it - instantly, and in place - into English or French. Oh, and Arabic if you fancy that too. Try it on this page... but don't use up my entire API usage limit, please. Obviously we're in Google's hands as regards the translations' quality: the French is certainly pretty accurate, and the Arabic... well, it looks about right anyway.

I'm also quite pleased with the 'world time' thing in the top corner: not only is it useful as a clock - but by placing dots on the map, it's a subtle way of reminding people where Djibouti actually is; and it underlines the strategic connections with France and the US (plus, by extension, the UN). The times are generated based on proper timezone data, and hence should remain accurate all year.

This time round, I've done all the design and coding myself. But I've had help with the configuration of the WordPress platform, from none other than Mike Little, the man who co-founded WordPress. Mike knows far more about server setups than I (hopefully!) ever will; he's done a great job tweaking things just that little bit more than normal: so whilst it's hardly military-level secure, it's certainly more robust than your average WordPress site - with very little compromising on usability.

It's been a challenging project, taking me into new territory in several respects, and all the more enjoyable for it. It's only by doing projects like these, and pushing yourself out of your comfort zone, that you really improve as a designer / developer / producer.

So far, Puffbox has a 100% record with political candidates: every one we've ever worked for has been successful. We'll see if this hot streak is maintained next April.

Tuesday 27 July 2010

New project adds iCal feed to WordPress 3

I've been working with well known LibDem blogger Mark Pack, whose day job is with PR company Mandate, to migrate the website of the Cancer Campaigning Group over to WordPress. It's a fairly modest little site, and I was under orders to keep the design broadly as-was. But it's got one specific feature I'm very excited about.

Nearly four years ago, I wrote about the increasing adoption of the iCal standard for calendar sharing. With Outlook 2007 set to embrace the format, I foresaw a rush of websites publishing event data in iCal feeds, allowing you to subscribe with a single click, and then see someone else's dates alongside your own.

The, ahem, optimistic assessment would be that I was well ahead of the curve. Four years on, you'll struggle to find many (mainstream) sites offering such feeds - although I've noticed a slight increase of late. The BBC, for example, had a feed of World Cup fixtures; the Arsenal site has a similar service for its new fixture lists, including the Reserves, Youth and Ladies teams. Why? Maybe it's the growing prevalence of smartphones by Apple and Google, both of whom were quick to adopt the format.

And then suddenly, the opportunity presented itself to build an iCal-enabled site of my own. The Cancer Campaigning Group's previous site had an 'events' section, although it wasn't anything special. WordPress 3.0, released just over a month ago, includes the ability to create 'custom post types'; and I only recently discovered its little-documented 'add_feed' function, introduced as far back as early 2007. A little jQuery on the front- and back-ends, and we had all the ingredients we'd need.

So I've written some code to create a custom post type called 'Event', and added it into the WP back-end interface. You enter event details just as you would enter a post or page, with a title, body text and optional excerpt. There's a special 'event type' categorisation; and a pop-up date picker for simplicity and consistency.

Then to call the calendar into a page, you use a WordPress shortcode - [calendar]. You can also specify the range (past or future), and the view (simple text list or javascript-enabled grid), plus the 'type' (if you're using them). This actually gives you remarkable flexibility, only some of which is obvious on the Cancer Campaigning Group site.

And of course - there's the iCal feed. If you take the feed URL into your calendar app of choice, you should be able to subscribe to it. And then, as the site admin adds new events, these will simply appear alongside your own personal appointments.

It hasn't been easy: and to be honest, I'm not entirely confident that we've captured and resolved all possible issues. The biggest problem has actually been with Google Calendar: Google caches the feeds for an indeterminate period, and there's no apparent way to force a refresh. So if there's an issue with your code, you may not realise for several hours; and it may take a further few hours for your fix to feed through. I'm also fairly sure that the code, as it currently stands, won't scale too well.

So for now, I'm watching the Cancer Campaigning Group site to see what happens. If it goes OK, I've got a couple of much higher-profile clients waiting in the wings.

Monday 8 February 2010

Yes you can change your Twitter ID. Don't.

A while back, Mark Pack wrote a couple of articles noting that if MPs were worried about breaking election campaign rules by running a Twitter account with the letters MP in it, they probably needn't be. The authorities tended to be 'sensibly flexible'; and besides, it was dead easy to change your Twitter account name. In the piece which appeared on LibDem Voice, I commented:

But is there a risk that someone grabs your temporarily vacated username? I can’t see anything in the Twitter documentation to suggest there’s a ‘grace period’ between one person giving up a username, and someone else claiming it… as is often the case, say, with domain names.

Funny I should ask. Last week, colourful Conservative MP Nadine Dorries changed her Twitter name to 'Nadine4MP', apparently following Tom Harris's lead. But somebody swiftly jumped in, and bagged the newly vacated NadineDorriesMP identity. Tim Ireland at Bloggerheads.com insists it wasn't him, and has done some further digging into who it might have been. The account is currently reporting 'that page doesn't exist'. Accusations and conspiracy theories are flying.

Yes, if you leave your main MP-labelled account dormant for a few weeks and switch to a new non-MP-labelled account, you'll lose a good few followers. But to be honest, if they don't follow you to your new location, they weren't following you very closely, were they?

Instead, where are we? No1 result from a Google search for 'nadine dorries twitter', and in the top 10 for plain 'nadine dorries', is the vacated, possibly hijacked, currently defunct @NadineDorriesMP account page. And this on the evening when said Ms Dorries is getting primetime terrestrial TV exposure for an hour.

You have been warned. Again. :)

that page doesn’t exist