i would like to add the .html extension by default to all my
resources. What is the best way to do that? The reason for this is
that i need to download the generated sites via wget and i need
the .html extension for the downloaded files. Also it would be nice if
the link_to would automatically generate the links with .html...
Maybe i was a little too unspecific with my description. Let me try
again:
The website has multiple nested pages and i can address them with
e.g. /pages/first /pages/first/subpage
Now when i want to wget all of the pages the downloaded files are
called first and subpage but
i'd like them to be called first.html and subpage.html so i figured
the easiest way to do that is to just add
.html at the end of all pages by default.
So when i add a resource to routes.rb like
resources :pages
i can call /pages/1 and i get the first page but again if i download
it the file would be called 1 instead of 1.html...
Also if i use link_to or url_for i get the links generated without
the .html at the end...
i tried
resources :pages, :format => :html
but i think the problem here is that html is the default mimetype and
so it's ignored. One sollution could be to set
another mimetype as default so i would have to add the html format for
every link i generate which would be ok for me...
sounds a little bit silly, bit i just tried a route like
map.connect ':controller/:action.html'
that is actually working for me
http://localhost:3000/bla/index.html
i would like to add the .html extension by default to all my
resources. What is the best way to do that? The reason for this is
that i need to download the generated sites via wget and i need
the .html extension for the downloaded files. Also it would be nice if
the link_to would automatically generate the links with .html...
That's a very bad idea. The better idea might be to add -E option to your
wget call (and maybe -k too).
why is it a "very bad" idea? i don't think that would be harmfull in
any way. But if i can't find an easy way to do it i will have to fix
it with wget...
why is it a "very bad" idea? i don't think that would be harmfull in
any way. But if i can't find an easy way to do it i will have to fix
it with wget...
Well, sorry, but hacking application to get the result for the
_external_ application (the same result you can get by adding two
characters to the command line)
does not sound like a good idea to me.
There are other reasons why file extensions are bad on the
web in general and in REST case in particular, but I won't go into
that now.