generate multiple html files in a single output subdirectory

64 views
Skip to first unread message

Dave Everitt

unread,
Apr 19, 2012, 5:55:05 PM4/19/12
to nanoc
I have a contact form (contact/index.html) with a script that returns
one of three static html pages according to input. I usually use the
following structure:

contact/
index.html
contact-thanks.html
contact-blank.html
contact-spam.html

I've looked through the manual but can't see a way to compile the
above structure with nanoc? I'd rather not have it generate contact/
contact-thanks/index.html etc.

Justin Clift

unread,
Apr 20, 2012, 3:58:10 PM4/20/12
to na...@googlegroups.com

Hi Dave,

That's what we needed for our sites too.

You can probably (pretty much) cut-n-paste our Rules file, into your own:

https://github.com/aeolusproject/aeolus-website/blob/master/nanocsite/Rules

Look specifically at lines 51 + 52:

# Write out haml files with a flat dir structure
item.identifier.chop + '.' + 'html'

That's what gives it the flat structure. Note that I had to surround that
with a sanity check (line 48), so nanoc doesn't barf if it comes across an
index.haml file in a subdir. You may or may not need that bit. :)

Hope that helps.

Regards and best wishes,

Justin Clift

Reply all
Reply to author
Forward
0 new messages