[Radiant] Developing behaviours for tagging

Andrew Montgomery darkliquid at darkliquid.co.uk
Sun May 21 05:27:38 CDT 2006


I'm pretty much happy with how my stuff has turned out now, so I'm
attaching the patch. It's to be applied against revision 42 and includes
a migration for adding the tag tables.

In my example, I have created a simple site structure.

My Site
  tags (Tag Display)
    tag-listing (Tag Listing)
  Articles (Archive)
    Article 1
    Article 2
  Random Page

tags has the following markup:

<ul>
<r:tags>
  <li><r:link> <r:name /> (<r:count />) </r:link></li>
</r:tags>
</ul>

tag-listing has the following markup:

<h1><r:tag:title /></h1>

<r:tag>
<r:children:each order="desc">
<div class="entry">
  <h3><r:link /></h3>
  <r:content />
  <r:if_content part="extended"><r:link anchor="extended">Continue
Reading&#8230;</r:link></r:if_content>
</div>
</r:children:each>
</r:tag>

And I have a special layout for any content that should display tags,
which includes this snippet:

<r:tags url="/tags/"><r:link /> </r:tags>

All of this produces a site that allows tagging for all pages, and a
page '/tags' that lists all available tags. Also, by going to
'/tags/[tag name]' you can see a list of content tagged with that tag.

If anyone is interested, let me know.

On Sat, 2006-05-20 at 17:34 +0100, Andrew Montgomery wrote:
> Well, I've managed to get the basics of what I wanted done.
> 
> After applying my patch, there is now a Tag Display behaviour and a Tag
> Listing Behaviour.
> 
> Tag Display basically provides tags for simply listing the tags and
> providing a link to that tag.
> 
> Tag Listing expects a tag as the last part of the url and then lists all
> the non-virtual, published pages that are tagged with the given tag.
> 
> There is a simple text-field for tagging in the more section of the
> pages.
> 
> There are some simple unit tests for it all, and so far everything seems
> to work well for a proof of concept.
> 
> If it ok to attach the patch on this list, just say so and I'll stick it
> up here. I'd like some other opinions on it :)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: tagging_support_latest.patch
Type: text/x-patch
Size: 15736 bytes
Desc: not available
Url : http://lists.radiantcms.org/pipermail/radiant/attachments/20060521/584ab25e/tagging_support_latest.bin


More information about the Radiant mailing list