Add page metadata properties to a page (using DPL)

From Semantic MediaWiki Community Wiki
Jump to: navigation, search


This is a very roughly written up tip that relies on the linked examples. Please feel free to improve this tip!

This tip is now outdated, see: Add page metadata properties to a page (using ED)

I put together a little hack to demonstrate the potential of capturing page metadata in semantic properties. This hack combines DPL with SMW, and adds information about:

  • the page author (creator),
  • most recent editor,
  • page size, and
  • page 'hit-counter'.

It does this by including a template on (almost) all pages that queries the above properties via DPL, and then wraps the result in semantic property annotations.

Here is the template:

Here is a random page that calls the template:

Here is an example of the properties in action (#asking for the 'most popular page' on the wiki):

I could add more of the page metadata that DPL provides (for example, the 'page created date' to generate an RSS feed of the new pages in the wiki):

however, there are problems with dates because DPL tries to return all dates in the users own timezone, which would mess things up... if properties were actually being updated, which apparently they aren't... (template caching issues I guess).

This hack resembles the nice looking functionality provided by the Semantic History extension:

but is a bit simpler (took a couple of hours to set up from 'scratch'), and also gives page size / hit counter.

It's far from perfect, but I just thought I'd throw it out there to see what people think. I know metadata isn't everyone's cup of tea, but it can be useful for administrative and site design purposes. If it looks useful, I'd like to try to put this into SMW 'on the inside' by coding up the relevant PHP.

dbolser, it appears that this is something that people want:
I, for one, wish that I could have much more sophisticated metadata accessible via SMW for the purpose of site development, and other uses within the scope of presenting information to users. Having to use DynamicPageList is a disappointment, since this is SMW's forte. Badon 16:20, July 13, 2011 (EDT)