Hi,
I am developing a site with nanoc and want to take advantage of apache
multiviews feature.
http://httpd.apache.org/docs/1.3/content-negotiation.html
here is how I am trying to use it.
The rules file has a route that generates .html files with the content
filename as the output filename as well like.
content/article1.html
content/article2.html
content/posts/post1.html
becomes
output/article1.html
output/article2.html
output/posts/post1.html
Now if I have a link to article1.html and article2.html from
post1.html I dont want the .html to be there in the link.
I just want the links to be generated to be pointed as /article1 and /
article2. On deployment Apache multiviews will take care of locating
the right files article1.html and article2.html respectively when the
above links are accessed.
Now nanoc generates the links with the same path as it was written
given by item_rep.path. I have been fixing this by writing a custom
helper function mimicing link_to only it does a
path.gsub!(/.html/,'')
to strip of the .html
But this is a poor solution as I see there are other helper methods
(sitemap, atom_feed) that use item_rep.path and I need to override
them all to keep chopping.
Is there a cleaner way to do this instead of overriding the helpers?
Some solutions that I thought of..
1. have a another property that contains the preferred link. like
item_rep.linkpath. but then howto tell rest of the code that generates
links to use this linkpath property instead of the path property.?
2. override item_rep.path so that it does what I want (chop
extensions). Is this is possible will it have any bad consequences?
Note: I know that the generated links with .html extension will also
work but I want it to be generated without them.