winton / stasis

Static sites made powerful
http://stasis.me
MIT License
679 stars 56 forks source link

How can one change the output file name ? #72

Closed trisulnsm closed 11 years ago

trisulnsm commented 11 years ago

I have been trying to find a solution to this problem for couple of days now, without luck. Pardon me if it is something obvious,.

Say my input directory structure is

/blog/first-blog/post.html.textile
/blog/second/post.html.textile

and I want my output to be

public/blog/first-blog.html
public/blog/second.html

instead of this

public/blog/first-blog/post.html
public/blog/second/post.html

How can I go about doing this ? I think instead is used for input replacement. Anything similar for output replacement ?

Appreciate any help.

winton commented 11 years ago

Hello, Vivek. You can do something like this in your controller:

before 'blog/first-blog.html' do
  instead render('blog/first-blog/post.html.textile')
end

You can use Ruby to glob your directory and generate these routes automatically of course.