00740: Allow "tagging" of pages

Summary: Allow "tagging" of pages
Created: 2006-05-19 03:01
Status: Closed - available in 2.2.0-beta13
Category: Feature
From: chr
Assigned:
Priority: 43
Version:
OS:

Description: The idea is to allow authors to give pages one or more tags. These tags can then be used to select or exclude pages from page listings. Since page listings are so powerful, we can then use this in several ways:

  • For plain pagelistings - excluding or including the tagged page
  • For trails - defined through the page having or not having a tag
A note about the choice of the word "tag". The word "tag" seems quite suitable for the purpose described on this page, but there might be better choices. One alternative candidate is the word "label". So when reading what follows, you can try thinking "label" in your head each time you see "tag".

Right now I "tag" a page by adding something like

(:comment tag-exclude-me:)

Now I can list of pages, excluding the tagged ones, using this markup

(:pagelist group={$Group} -"comment tag-exclude-me":)

This is actually typical how I use tags. I want the group's home page to list all pages except some pages which would just confuse/distract the reader. (I know that the 'list=' parameter can be used to exclude pages from the result, but I prefer not having to modify config.php for this purpose).

Another use for tags would be to create trails, where the trail is comprised of pages with a certain tag. Imagine for instance that all pages in a certain trail are tagged with

(:comment trail1:)

It is then possible to generate the trail using something that is roughly like:

(:pagelist group={$Group} "comment trail1" fmt=trail:)

Perhaps even more useful would be to generate the trail based on all pages in the group that aren't tagged!

As a very practical example of where this tagging could be useful, let's say we tag PmWiki's documentation pages. A simple pagelist could then be used to dynamically produce a list of all the documentation pages.

Adding "tag=" to (:pagelist:)

I'd like to augment (:pagelist:) so that it can take the argument "tag=". It should then be possible to use this command

(:pagelist group={$Group} tag=tag-text:)

to list all pages tagged with 'tag-text'. Similarly,

(:pagelist group={$Group} tag=-tag-text:)

should list all pages not tagged with 'tag-text'.

An alternative solution for tagging pages

Instead of using (:comment tag-text:), we could introduce the markup

(:tag tag-text:)

which would tag the current page with 'tag-text'. Using several such markups would give the page several tags. Doing this as a cookbook recipe is trivial... the markup just outputs nothing.

Here are some advantages of (:tag:) over the approach with (:comment:):

  • Verbose. "(:tag something:)" is more verbose and clearly a tag instead of something that might just be a comment. When using a comment, I'd probably write (:comment tag-something:) just to emphasize that this is a tag and not a normal comment.Changing a comment usually doesn't affect anything, but if the comment is actually a tag that is not the case...
  • Writing (:comment tag-something:) is a bit longer than writing e.g. (:tag something:).

Another alternative solution for tagging pages

Perhaps page attributes could be used for tagging pages? The tag would then be a page attribute. I'm not sure how/if this allows you to give a page several different tags.

Tags vs categories

The tag functionality is similar to that of categories. PmWiki's documentation pages could for instance be categorized, but this unfortunately means using a part of the "category name space". It probably also means that the group Category should come pre-configured with PmWiki.

Another difference is that adding [[!category]] produces a visible link. As I've imagined tags, they aren't really visible on a page. You could probably make the category link not show up, perhaps through (:comment [[!category]]:).

To be honest, I'm not completely convinced that tags are so different from categories, but for some reason I feel much less hesitant about adding a tag such as (:tag dont-include-me-in-listing:) when I now that it won't show up in the page Category.Category. Maybe it is because the tag is there for a technical reason, and not so much about saying that the contents of this page belongs to a certain category.

Contributors

  • Christian Ridderström

Have you seen this: Cookbook.Tags ? uudo August 11, 2006, at 01:38 PM


This capability now exists (in lots of really cool ways) in 2.2.0-beta13 via page text variables.

Pm