Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merging changes from saturnflyer's blog extension into a fresh branch.
Merge branch 'master' of git://github.com/saturnflyer/radiant-blog-extension into blog Conflicts: README Rakefile app/models/sibling_tags.rb spec/models/sibling_tags_spec.rb
- Loading branch information
Showing
4 changed files
with
279 additions
and
318 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,86 +1,10 @@ | ||
= Sibling Tags | ||
= Blog | ||
|
||
This extension for Radiant provides tags allowing you to refer to the neighbouring siblings of a page. | ||
The Blog extension has been built to provide support for commonly used features of | ||
web logs. It is a conglomeration of multiple extensions and new features. | ||
|
||
== Installation | ||
Some features from: | ||
git://github.com/nelstrom/radiant-sibling-tags-extension.git | ||
|
||
If your Radiant site is running on version 0.6.9 or greater, you can install extensions very easily. If you are using an older version of Radiant, don't worry, it is still quite straightforward. Instructions follow for both. | ||
|
||
=== Installing for Radiant 0.6.9+ | ||
|
||
In a terminal, <tt>cd</tt> to the root directory of your Radiant site. Run the following command: | ||
|
||
script/extension install sibling_tags | ||
|
||
That's it! | ||
|
||
=== Installing for Radiant pre-0.6.9 | ||
|
||
This extension is hosted on github. If you have git installed, then <tt>cd</tt> to the root of your radiant project and issue this command: | ||
|
||
git clone git://github.com/nelstrom/radiant-sibling-tags-extension.git vendor/extensions/sibling_tags | ||
|
||
If you don’t have git, then you can instead download the tarball from this URL: | ||
|
||
http://github.com/nelstrom/radiant-sibling-tags-extension/tarball/master | ||
|
||
and expand the contents to <tt>your-radiant-project/vendor/extensions/sibling_tags</tt>. | ||
|
||
This extension does not modify the database, so there is no need to run any migrations. Your done! | ||
|
||
== Usage | ||
|
||
When you restart you Radiant site, you should have access to the sibling tags in regular pages of your site. Documentation for each individual tag is provided within Radiant. If you go to edit a page, then click the '<b>Available tags</b>' link, you should see a list of all the available tags. You can filter the list, by typing 'sibling' into the field at the top right of the window. | ||
|
||
For examples of usage, we'll use the following site map: | ||
|
||
Title Date of Publication | ||
---------------- ------------------- | ||
Home | ||
\_Articles | ||
\_Apple 2008-02-29 | ||
\_Brocolli 2007-12-17 | ||
\_Carrot 2008-01-25 | ||
|
||
Using the sibling tags, you can access immediate neighbours of a page. But which pages are considered neighbours depends upon how you shuffle the deck! You can sort pages by any field that is stored in the database. Most likely you will want to sort by date of publication, or by page title. These could also be arranged in ascending or descending order. | ||
|
||
By default, pages are sorted in ascending order of publication, i.e. from oldest to newest. The children of 'Articles' in the above site map would be arranged as follows: | ||
|
||
Default order: Brocolli, Carrot, Apple | ||
|
||
Lets examine the following snippet of code: | ||
|
||
<r:siblings> | ||
<r:previous>Previous article: <r:link/></r:previous> | ||
<r:next>Next article: <r:link/></r:next> | ||
</r:siblings> | ||
|
||
If this was called on the 'Carrot' page, it would output: | ||
|
||
Previous article: <a href="/articles/brocolli">Brocolli</a> | ||
Next article: <a href="/articles/apple">Apple</a> | ||
|
||
Whereas, if the same snippet was called from the 'Brocolli' page, it would output: | ||
|
||
Next article: <a href="/articles/carrot">Carrot</a> | ||
|
||
When arranged in the default sort order, 'Brocolli' comes first, so it has no predecessor. Hence, the contents of the <tt><r:siblings:previous></r:siblings:previous></tt> tag are not output. | ||
|
||
You can change the sort order using the <tt>order</tt> and <tt>by</tt> attributes. <tt>order</tt> can either be <tt>asc</tt> or <tt>desc</tt>, whereas <tt>by</tt> can be any column name associated with a page in the database. | ||
|
||
The following lists demonstrate how the 'Articles' pages above could be sorted: | ||
|
||
order="desc": Apple, Carrot, Brocolli | ||
by="title": Apple, Brocolli, Carrot | ||
by="title" order="desc": Carrot, Brocolli, Apple | ||
|
||
Remember that the default values are <tt>order="asc"</tt> and <tt>by="published_at"</tt>, so if either of these are not specified, they fall back to those values. | ||
|
||
One final example demonstrates how these sorting options may be applied: | ||
|
||
<r:siblings> | ||
<r:previous by="title">Previous in alphabet:<r:link/></r:previous> | ||
<r:unless_previous by="title">This is the start of the alphabet.</r:unless_previous> | ||
<r:next by="title">Next in alphabet: <r:link/></r:next> | ||
<r:unless_next by="title">This is the end of the alphabet.</r:unless_next> | ||
</r:siblings> | ||
Built by Saturn Flyer http://www.saturnflyer.com and many others | ||
Supported by Ignite Social Media http://www.ignitesocialmedia.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.