Routing variables

67 views
Skip to first unread message

aljoscha

unread,
Jun 25, 2011, 4:17:47 AM6/25/11
to middleman-users
I am currently struggling to get an understanding of how middleman
works.
The main question I have is this:

I want to have URL paths like "projects/houses", "projects/hotels"
etc., where the second part (type of project: houses, hotels) should
be flexible and
should come out of a data structure (preferably from the YAML data
API).

I would like to define only one view that receives the type as a
variable (like in rails routing "projects/:type") so that I don't have
to setup a view for each type
Still when I build the project, I want one static page per type, like
"projects/hotels/index.html" or "projects/hotels.html"

How would I accomplish that with middleman? Is it even possible?

Thanks for your help
Aljoscha

Thomas Reynolds

unread,
Jun 25, 2011, 3:10:32 PM6/25/11
to middlem...@googlegroups.com
In Middleman, all output files are tied to individual template files. There is no way to generate multiple pages based on a structure other than actual files.

I do believe Nanoc has this feature. If it is a must have, you might want to check out that project.

-Thomas

Alexander Presber

unread,
Jun 26, 2011, 4:57:11 PM6/26/11
to middlem...@googlegroups.com
I see, thanks a lot.
I have now used nanoc successfully. I can see why you developed middleman, though, there is quite a bit more to learn before you can start.
Cheers, Aljoscha
Reply all
Reply to author
Forward
0 new messages