I wanted to generate a sitemap for my radiant powered site and used this
code:
Unfortunately it doesn’t work since r:children_each is non recursive.
Anyone
has an idea on how to make it recursive?
I wanted to generate a sitemap for my radiant powered site and used this
code:
Unfortunately it doesn’t work since r:children_each is non recursive.
Anyone
has an idea on how to make it recursive?
Giovanni -
I would first create a global tag, using any one of the methods
previously
discussed on the mailing list. The tag would be defined like so:
tag “if_children” do |tag|
tag.expand if tag.locals.page.has_children?
end
Then I would create a snippet that is similar to yours called “sitemap”:
<r:children:each>
In the page that I want the sitemap I would do this (the find tag is
optional, depending on where you want the sitemap to start):
<r:find url="/>
Good luck!
Sean C.
seancribbs.com
Thanks, that kind of recursion what was I looking for. Actually you
don’t
even need the if_children tag since <r:children:each> won’t execute if
there
are no children.
2006/9/14, Sean C. [email protected]:
This is the final code I used.
In the sitemap page:
The sitemapper snippet:
<r:children:each>
<r:unless_content part=“no-map”>
2006/9/14, Sean C. [email protected]:
On 14/09/06, Giovanni I. [email protected] wrote:
This is the final code I used.
Thanks for posting this!
I’ve updated the wiki’s HowTo section with a ‘Recipies’ section, as
discussed on list last week, and made this the first one!
http://dev.radiantcms.org/radiant/wiki/HowToMakeASiteMap
The only significant change is that I made use of
<r:children:each by=“title” order=“asc”>
as otherwise the sitemap is ordered by Radiant’s page id numbers so
the first page in the sitelist is the first page created
–
Regards,
Dave
2006/9/14, Dave C. [email protected]:
On 14/09/06, Giovanni I. [email protected] wrote:
This is the final code I used.
Thanks for posting this!
I’ve updated the wiki’s HowTo section with a ‘Recipies’ section, as
discussed on list last week, and made this the first one!
Well it’s a honor to be the first there
The only significant change is that I made use of
<r:children:each by=“title” order=“asc”>
as otherwise the sitemap is ordered by Radiant’s page id numbers so
the first page in the sitelist is the first page created
I was sure I was using by=“title”
– Giovanni
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs