Html sitemap


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.


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_path(page) %>

and then add the static stuff

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

how are your pages stored that you want in the site map?

Freddy A. 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
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
clever way to do that by ripping the routes.rb map!


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs