Pingomatic For Perch

I love the Perch CMS. It isn't crammed with features and plugins to placate each and every type of developer; it just does the Content Management task really well. Nonetheless, every so often I look for a little tool that Wordpress-derived muscle memory tells me should be present, and I'm left wanting.

The Perch admin navigation
The 'Send Pings!' button

One such feature was XML sitemap support, which I covered in my article A Perch XML Sitemap. In this post, I'm going to help Perch bloggers incorporate Ping-o-matic.

What is Ping-o-matic?

Ping-o-matic is a service that allows you to 'ping' various blog-specific search engines and notify them that your blog's content has been updated. In turn, these search engines will find a way to notify their readership that you've made new content available, driving traffic to your site. Clearly, this is advantageous — which is why Wordpress automatically sends 'pings' via ping-o-matic whenever you publish an article.

It would be possible to send pings automatically in Perch, but we're not going to build anything quite so intrusive. Instead, I have written a little bit of code which allows you to ping Ping-o-matic's roster at the touch of a button. Because Ping-o-matic's webform uses the GET method, this task is made very easy. To add the functional button to your admin navigation, simply open perch/inc/top.php and paste the code to follow in at line 140 (approx), just before echo '<ul>';. When you click the button, a new tab is openned detailing which pings were sent where.

echo '<li><a style="background:#7bc142;" id="send-pings" href="'.$_SERVER['SERVER_NAME'].'&blogurl=http%3A%2F%2F'.$_SERVER['SERVER_NAME'].'&chk_weblogscom=on&chk_blogs=on&chk_feedburner=on&chk_newsgator=on&chk_myyahoo=on&chk_pubsubcom=on&chk_blogdigger=on&chk_weblogalot=on&chk_newsisfree=on&chk_topicexchange=on&chk_google=on&chk_tailrank=on&chk_postrank=on&chk_skygrid=on&chk_collecta=on&chk_superfeedr=on" target="_blank">Send Pings!</a></li>';

Customising the code

You'll notice that I've used $_SERVER['SERVER_NAME'] for both the 'title' and 'blogurl' parameters. If you wish to send a different title, just replace my variable. If there are certain services you do not wish to ping, simply remove the associated parameter. For example, if you don't want Feedburner users to sully your content with their mere gaze, remove &chk_feedburner=on from the query string.

Lastly, Ping-o-matic also allows you to provide your master RSS location. I haven't included this because I've no idea where you keep your RSS, but you can use the rssurl parameter something like this:


That's it. If anyone has any ideas on improving this little hack, please get in touch. I'm @heydonworks.