I was interested in how blog posts often include a set of small icons giving the reader direct access to social bookmarking sites such as del.icio.us, ma.gnolia, or furl. Accomplishing this in PmWiki is relatively simple. I used Peter Harkins's Sociable for WordPress as a kind of guide for how I wanted this to look.

The only part that took a bit of thinking was how to include the title of the page. It wouldn't seem to be an issue, except I want it to be dynamically added to the URL, and these bookmarking sites prefer plusses instead of spaces in the urls, etc. Basically you have to make the urls valid. So I had to come up with a way to do that.

First, you need to provide the engine with the right tools to construct useful URLs for this thing. With some help from the PmWiki users list, I was able to create some custom markup to urlencode the necessary text. Now you can urlencode any text with (:urlencode whatever:).

Second, you need to create a page in PmWiki that has all of the links/images that you want/need, that will be included on any page that you want this clickable list to appear. I've included a page called Site.SocialBookmarkIcons which you can use. As well, you'll have to upload the images for the various sites you want.

Third, you have to somehow style the list. That's accomplished in my recipe by placing a css file in the /pub folder and adding that via $HTMLFooterFmt (or $HTMLHeaderFmt).

Now the most important thing: I have made it easy for you. Just download the zip file Δ. After unzipping this, you'll find the following:

  /social-bookmark-icons
    social-bookmark-icons.php
    social-bookmark-icons.css
    /wikilib.d
      Site.SocialBookmarkIcons
    /uploads/Site
      (numerous image files)

put this folder in your Cookbook folder, and put this line in config.php:

  include_once("$FarmD/cookbook/social-bookmark-icons/social-bookmark-icons.php")

Leave the /wikilib.d folder where it is. Move social-bookmark-icons.css to your pub/css folder. Move the image files to your /uploads/Site folder.

Finally, whenever you want to have this list in your page, you just do this:

  (:include Site.Social:)

And that's all! In order to include this in a pagelist, as I've done here using BlogSimple2, you have to use another scheme, because page variables (such as {$TitleSpaced} will refer to either the page being browsed {*$Titlespaced} or the original page, but not a page that included the original page and then was displayed using a pagelist. So you have to make sure that you're using something like (:urlencode {=$Titlespaced}:) when you want the title of your post, for example.

Note: This post was updated after I figured out how to really do the url encoding bit.

tags >>

Posted in ,



Add a comment

Name:
E-mail: (for gravatar only, not stored.)
Website: (e.g. google.com)
Type your comment
Type this number: 508