github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

santry / blog_tags

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 3
    • 1
  • Source
  • Commits
  • Network (1)
  • Issues (0)
  • Downloads (0)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (1)
    • master ✓
  • Tags (0)
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

An extension that provides some useful blogging tags for the Radiant CMS — Read more

  cancel

http://seansantry.com/projects/blogtags/

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Updated to new github repo at http://github.com/santry/blog_tags/ 
santry (author)
Tue Jun 02 10:06:56 -0700 2009
commit  127846bd97ba4cca2a7789f8f91ac0a47b9c8a14
tree    7089871edc9f9e918c67ad29f017a16e479bf933
parent  99425b058b1d55cc89b8e677b55e08c10825b431
blog_tags /
name age
history
message
file LICENSE Loading commit data...
file README.markdown
file Rakefile
file blog_tags_extension.rb
directory lib/
directory test/
README.markdown

BlogTags

BlogTags is an extension for the Radiant CMS that provides some useful blogging tags. OK, for now there are just three tags. But they're really useful. Honest!

The latest version is available on GitHub.

    git clone git://github.com/santry/blog_tags.git

previous and next

The previous and next tags get the previous and next siblings of the current page, sorted by the published_at date. For example,

<r:previous><r:link/></r:previous>

will get the previous page according to the published_at date and output a link to it. You can specify which attribute to use for comparison in the by attribute. To get the next page according to the page title, use

<r:next by="title"><r:link/></r:next> 

Inside the next and previous tags you can use whatever page tags you like and they'll refer to the next or previous page. If your pages have a summary part, you could output the summary for the next page like this:

<r:next><r:content part="summary"/></r:next>

Of course I have no idea why you'd want to do that, but you could.

Since this is the BlogTags plugin, the previous and next tags are designed to be used in a blog. Here's how I use the previous and next tags on my site to provide links to the previous and next blog entries:

<div class="article-nav">
    <p><r:previous><r:link>&laquo;&nbsp;<r:title/></r:link>&nbsp;&nbsp;</r:previous>
       <r:next><r:link><r:title/>&nbsp;&raquo;</r:link></r:next></p>
</div>

This produces HTML like

<div class="article-nav">
    <p><a href="/articles/2006/06/06/jimmy-and-ginas-wedding/">&laquo;&nbsp;Jimmy and Gina's Wedding</a>&nbsp;&nbsp;<a  
        href="/articles/2006/06/22/railsconf-2006/">RailsConf 2006&nbsp;&raquo;</a></p>
</div>

When you're viewing the first page in a sequence, the previous tag outputs nothing. The next tag outputs nothing if you're at the last page in a sequence. Also, virtual pages (like "Archive Day Index" or "Page Not Found") are excluded from the page sequence, since you probably don't want to link to them this way.

time_ago_in_words

The time_ago_in_words tag outputs the published_at date of the page (or, for unpublished pages, created_at) in natural language. For example, if it's 4:00pm and the page was published at 1:00pm the tag

<r:time_ago_in_words/>

would output about 3 hours. I use it like this in my blog:

<p class="article-author">Posted by <r:author /> <r:time_ago_in_words /> ago</p>

which outputs something like:

<p class="article-author">Posted by Sean about 3 hours ago</p>

Questions?

If you have questions you can find me on the Radiant mailing lists or you can contact me through my website. Good luck!

Acknowledgments

Thanks to John Long for creating Radiant and for providing a starting point for the previous and next tags. Thanks also to Sean Cribbs for his suggestion on simplifying my time_ago_in_words implementation.

Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server