Forum: Ruby on Rails html sitemap

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
A7d147ef1fae3fc5e183b44be8959ace?d=identicon&s=25 mumf83 (Guest)
on 2009-05-12 22:30
(Received via mailing list)
Hi,

I'm trying to create a hierarchy html page of a sitemap from my
routes.rb file. Each entry needs to use its name and link to its page.
I keep finding stuff about using an XML sitmap but I don't want this
as I want it to be human readable. Can anyone help me with this? This
is my first project using Ruby on Rails so I might be missing
something really easy but havn't seen it yet.

Thanks.
4c438a80fc30661ad619ea177cf9cbd0?d=identicon&s=25 Freddy Andersen (Guest)
on 2009-05-12 23:34
(Received via mailing list)
Creating a sitemap xml or html is just as easy as any other page...

In the controller pull the resources that are dynamic like

@pages = Pages.all

and then in the view do

<% @pages.each do |page| %>
<%= link_to page.name, page_path(page) %>
<%end%>

and then add the static stuff

<% %w( page1 page2 ).each do |page| %>
<%= link_to page.name, some_path(page) %>
<%end%>

how are your pages stored that you want in the site map?
Aafa8848c4b764f080b1b31a51eab73d?d=identicon&s=25 Phlip (Guest)
on 2009-05-13 00:33
(Received via mailing list)
Freddy Andersen wrote:
> Creating a sitemap xml or html is just as easy as any other page...

Furtherless, I would not rip the routes.rb map to generate it, because
such
routes are either boring and static, like /app/faq, or are dynamically
generated, like /blog/post/:name, and it's the interesting ones we need
in the
nav bar or site map. I would be interested to see if anyone can think of
a
clever way to do that by ripping the routes.rb map!

--
   Phlip
   http://flea.sourceforge.net/resume.html
This topic is locked and can not be replied to.