Blog

WordPress: Structured Blogging Tutorial I – Getting started

Thanks to MP:Carsten i came across the structured blogging plugin. I instantly checked this plugin out, and was so thrilled about it that i spend the whole last night getting into it. Since this is a very exiting approach, i thought it is really needed to have a HowTo.

But first for those of you that haven´t heard to much about it, a short introduction on the Plugin and the idea of structured blogging. After that I´ll go into the details.

What is this plugin about?

The structured Blogging-Plugin gives you the ability to enter a posts Data via several Form Fields. Normally you only have fields for the title, the exerpt and the post. For most people this is totally enough. But what, if you where to write let´s say, Book reviews on a regular basis? Or like I do in this blog, publish plugins for a software. In this case you need a structure in your content which should be consistent in all posts.
I had the problem just three days ago, when i looked in one of my plugin posts -> the LiveChat eXtended. The post was not very good structured and so are still some of the others. My simple way of getting it better was putting in some Headlines and looking on other pages for inspiration.
This is not a very satisfying approach because in every new posting i would have to copy the old posts structure. But this is not just a local problem in our Blog. Just imagine how many websites you´ve searched for a Plugin or maybe a book review. I bet you´ve seldom seen the same structure twice. This is just an optical point of view, but content can be exchanged between software f.ex. per RSS Feed or XML files. The structure of normal posting is to simple for an intelligent exchange

Lets go one step ahead and imagine (i´ll stick with my 2 examples) amazon or the WordPress-Pluginsite would be able to automaticly aggregate you content into their site. This would save a lot of people, a lot of work. The readers advantages are: faster finding, faster reading, better comaprison and interchangebility of Content. If you still wonder, just think of postings about restaurants, recepies, Events, …

The Structured Blogging Plugin already has several content structures implemented. This is done via XML files which render the backoffice with the data fields and also the content display in the frontend. Further it renders an rdf-feed of the content Item, so it can be accessed by other software-readers. The two screenshoots show an example of a book review.

Backoffice View:

 Backoffice View of structured Blogging

Frontend View:

Frontend View of structured Blogging

Before we start playing around with the plugin, be aware that this is still in beta stage. Please backup your files and data, and setup a test-enviroment. The plugin seems to work ok, but already hab some compatibility issues with other plugins in WordPress 2.0, mainly the PostRestrictions . I know the 60 % of the reasons for that and will dig deeper later on.

The Plugin Filestructure

/admin/ -> There are 8 files to be put in the /admin/ folder. Those are for representing the backoffice.

/plugins/structuredblogging.php ->the main plugin file – is of course put in the plugin folder

/wpsb-files/ a standalone folder in wp root. Here lies the xml + field intelligence -> the brain !

– /wpsb-files/microcontent/ -> php class libraries for rendering the xml and HTML Structures

/wpsb-files/microcontent/descriptions -> found this folder :-) well you got the plugin by it´s balls now. Those are the xml files resposible for the Contentfields. New structures or changes in existing structres need to be done here.

First look

The first look after the install goes into the backend. You´ll notice a whole bunch of new items under the writing pane plus a new menu under options.

The options panel gives you 4 config options. At the beginning only the first two (in my list) are really important:

– Upload file Folder-> you should definitly set this value

– use structured Blogging Stylesheet -> uses the css sheet provided, later on you should adapt your own classes

– Amazon affiliate Link if you are using their service

– Outputthis.org Account Details -> i´ll have to check this out, sound interesting

I think you can click your way alone into the new content items and set up some dummy Data. So we step right into the first customizations

Customizing the Admin Menu

You´ll probably want to customize the "new Article Menu" to have a quick acces to your most used Items, get rid of some options or just rename the Menu Items. There are two types of links in this menu. One over which you can access the new Item directly and on with an overview of the available Items of one type. Oh i forgot the third one -> this is the last option "Other microcontent" which you should alway keep to acces all of your items.

Open the file -> /plugins/structuredblogging.php

At the very beginning there is an long multidimensional Array wich stores the menu Items. (nice trick by the way i´ll have to adapt this) You can change the values or delete/uncomment some of the array Items.

An Item looks like this:

Array("title" => "Review",
"script" => "sb-post.php?sb_cat=Review",
"id" => "x-wpsb-post",
"version" => 1),

– The Title is the Name for the menu. You can rename or translate this value

– The script is the either a link to the category-page (like above) or a direkt link to a new content Item of the given Type-> would look like this -> sb-post.php?sb_mc_type=event/concert
This is interesting and needed later if you build your own structures, so some more words on this notation.

"event" is the category name and "concert" the content type. This value is also defined in the header of every xml-description file.
If you want to add a direkt link to a new item you have to use this notation. Just go to the "Other microcontent" page and and look at the links.

– id we just take this for granted right now.(i kinda know but before i write some wrong i don´t)

– Version refers to the version of the content-type document (guess)

The next step takes a look into the XML File to do some basic editing

Template structure + Basic editing

open -> /wpsb-files/microcontent/descriptions

For each item visible in the backoffice you´ll see one template XML file. Hint: you can call the directory in your browser to see a list with all available templates (generated by the index.php) Open the list.xml file (just because this is the shortest)

A template is devided into 3 regions.

1. The header:

<micro-content type="list/list" label="List" version="1.0"> .. </micro-content>

Here you set the category+name in the type attribute, the label and the version. you need to close the header at the end of the file.    

2. The Frontend Display

<display media="html">
    <group content="/list">
        <ul class="xoxo">
            <group repeat="unlimited" content="item"><if content=""><li><field content=""/></li></if></group>
        </ul>
        <if content="description"><div><field content="description"/></div></if>
        <if content="tags"><p><i>Tags: <field content="tags"/></i></p></if>
    </group>
</display>

 This is what makes up the formating in the frontend. Those values are saved in the WordPressPost-Table. I´ll cover the whole Tag-Sytax in another article, so here just a simple description.
– display media -> output Type
– group content="/list" -> group content Items together, here a list if the Items.
– Ul and Li output The class given to the UL comes from your stylesheet
– if content="description" -> this is the description field of the list. Intersting here is the wrapping with the if. this only shows the embeded code if the item is not empty

You can play a little around in here just be carefull to not break the symantic structure. You could f.ex. put a <hr> above the description or move the description to the top above the UL

3. The Admin Display

<editor>
    <group content="/list">
        <table class="sb_boxtable" width="100%">
        <tr><td>
            <group repeat="unlimited" content="item" addlabel="Add another item">
                <field label="Item" content="" length="100"/>
            </group>
        </td></tr>
        <tr><td>
            <field label="List notes" content="description" type="textarea" width="97%"/>
            <field label="Tags" content="tags" type="tags" length="100"/>
        </td></tr>
        </table>
    </group>
</editor>

– group repeat="unlimited" content="item" addlabel="Add another item"
group+ repeat tells the list to add a new item; content is the list-fieldname ; addlabel is the list-abel. Inside this loop is the actual item embeded
          
In the backoffice you will probably translate the fields labels first or add a new field. If you add a new field be aware to add it to the frontendview too. If you need other fields you should check the existing files first if you find similar structures.
The indenting of the code is pretty important, because at some point if you srew up your template, it is simpler to check.

New Templates are created by copying an existing template (for the basic structre) and just changing the header Type-Field-Name. The new template can be called over it´s name in the admin backoffice -> sb-post.php?sb_mc_type=newCategory/NewStructure Type or they can be found in the other Microformats-Menu which reads out all existing templates.

When you got this far you´ll probably want to know what content types there are to put in the templates. For the coders, have a look into /wpsb-files/microcontent/wpsb-files/microcontent/ there are the classses which render the html output of the fields.

A rather technical description of the XML files can be found here

Summary & Links

I´ll try to continue this tutorial and get a little more into the coding details, but i´ve only spend a couple of hours on the Structured Blogging issue yet.
I think this will be one very important step in Web Content Structuring and not only Blogging. But for the blogging part: In the past five years i´ve seen a lot of Open Source CMS ´s come an go but nothing i´ve seen has driven people more to produce content. This has several reasons but the most important one to me .. it is EASY.

So with the spreading of plugins like this, the Strucured Content Idea will float the web within a short time. New Structures and Standarts are needed for a wide variety of content and new aggregator services and software will appear. I´m kinda thrilled about this development and will spend more time to dig deeper.
Here are a couple of links to beginn with:

Structured Blogging Formats

WordPress Structured Blogging Plugin Zip

Structured Blogging Blog

Structured Blogging WIKI

If you have more Informations, critics or annotations i´ll greatly appreciate your feedback

2 Comments to WordPress: Structured Blogging Tutorial I – Getting started

  1. 08.07.2008 at 17:40

    I Have some problem when i save with the script. It does not save the „category“ Do you know why ?
    Tanx in advance !

  2. 01.02.2006 at 4:45

    Structured Blogging und Events

    „…I’ve had an event calendar/guide called Exploit Boston percolating [] … there’s this nifty Structured Blogging plugin and also Kevin Shay’s BigPapi and RightFields plugins (the later for Movable Type only and the former for WordPress and Movable Type). I’m excited about the idea that I might actually be able to update the site more often thanks to these new tools…“

    http://www.sooz.com/2006/01/03/structured-blogging/

  1. By on 11.08.2006 at 14:24
  2. By on 03.05.2006 at 13:29