public
Fork of aslakhellesoy/radiant-tags-extension
Description: Extends Radiant CMS with tagging capabilities. Tagging as in "2.0" and tagclouds.
Homepage: http://gorilla-webdesign.be
Clone URL: git://github.com/sjlombardo/radiant-tags-extension.git
sjlombardo (author)
Tue May 26 20:07:36 -0700 2009
commit  4a9a16b2ebd9451238f0e367072664b7cf8ffed9
tree    1e19df730480230e4fac7e7717406c86da6d1513
parent  4c1a4f4e8a43e9e5e0e4c008c6082c887c98dcee
name age message
file README Thu Jul 03 09:32:22 -0700 2008 updated with new features, added credit [saturnflyer]
file Rakefile Tue Mar 25 18:48:56 -0700 2008 woops git-svn-id: svn://zuurstof.openminds.be... [jomz]
directory app/ Loading commit data...
directory db/ Tue Mar 25 18:48:56 -0700 2008 woops git-svn-id: svn://zuurstof.openminds.be... [jomz]
directory lib/ Sun Aug 17 17:35:27 -0700 2008 Added more resilience for SQLite3 [aslakhellesoy]
directory public/ Tue Mar 25 18:48:56 -0700 2008 woops git-svn-id: svn://zuurstof.openminds.be... [jomz]
file tags_extension.rb Sat Aug 23 05:08:35 -0700 2008 Raise an error if Radiant::Config is missing 't... [aslakhellesoy]
directory test/ Thu Jul 03 07:59:12 -0700 2008 added with_any option to search pages with any ... [saturnflyer]
directory vendor/
README
= Tags extension

Created by: Keith Bingman - keithbingman.com
Revived by: Benny Degezelle - gorilla-webdesign.be
New features by: Jim Gay - saturnflyer.com
Version: 0.2
Contact: benny AT gorilla-webdesign DOT be

This extension enhances the page model with tagging capabilities, tagging as in "2.0" and tagclouds.


== Requirements

This extension depends on the shards extension and the has_many_polymorphs plugin
Shards should be installed and loaded first; you can change the load order of extensions in config/environment.rb (see 
http://wiki.radiantcms.org/Using_the_Shards_Extension).


== Installation

1. Copy the extension to your vendor/extensions directory as you would any other extension.
2. From your instance root, run 'rake db:migrate:extensions' to create meta_tags & taggings tables.
3. Then run 'rake radiant:extensions:tags:install'
  Which will copy tags.css to your stylesheets folder. You might want to edit this file.
4. Add the tags.css to your layout;
    <link rel="stylesheet" type="text/css" href="/stylesheets/tags.css" />
5. Make a page to sit in /search/by-tag, and give it the "Tag Search" pagetype.
  If you want to change this location, it's in Radiant::Config['tags.results_page_url'].
  Copy the results page example below, and modify to your likings;


== Results page

<r:search:empty>
  <h2>I couldn't find anything tagged with "<r:search:query/>".</h2>
</r:search:empty>

<r:search:results>
  <h2>Found the following pages that are tagged with "<em><r:search:query/></em>".</h2>

  <ul>
  <r:search:results:each>
    <li><r:link/> - <r:author/> - <r:date/></li>
  </r:search:results:each>
  </ul>
</r:search:results>


== Tag cloud

Use <r:tag_cloud /> anywhere you like.
I made a stab at building the 'perfect' tag cloud markup, as inspired by a post on 24ways.org;  
http://24ways.org/2006/marking-up-a-tag-cloud


== Tag list

Use <r:tag_list /> to get a list of tags for the current page. 
Also works through children:each.

== All tags

Use <r:all_tags /> to get a list of all tags. You may iterate through them with
<r:all_tags:each> and access their associated pages with <r:all_tags:each:pages:each>

== Collections

You can grab a collection of pages with a certain tag like so;

<r:tagged with="sometag" [scope="/some/page"] [with_any="true"]>
  <r:link />
</r:tagged>

Which would iterate over all the resulting pages, like you do with children:each.
When you define scope, only this page and any of it's (grand)children will be used.
You can also set limit, offset etc like with children:each.

Using r:tagged in it's default setting searches for pages that have all of the given tags.
Using r:tagged with the attribute 'with_any' set to 'true' will find pages that have any of
the given tags.