custom routes for pages ... ?

27 views
Skip to first unread message

dgurba_ucsb

unread,
May 28, 2008, 6:34:11 PM5/28/08
to nanoc
hi,

I'm redoing my site (again?) ... and I want:

site.com/blog/

site.com/blog/foobar

each to go to their own blogs with different topics ... I have the
layouts done with the code to limit the post material to the right
topics ... but I can't get the routing to work right.

I tried adding:

custom_path: "/blog/" to a folder that is called blog_main/

But then "autocompile" gives a 404 upon visiting the page ...

Is is this a Webbrick issue or am I confused someplace else??

Halp! (no that is not a mis-spelling ... it's a word damnit)

thank you,
david g.

Denis Defreyne

unread,
May 29, 2008, 3:58:34 AM5/29/08
to na...@googlegroups.com
Hi David,

A page's "custom_path" attribute cannot be the path to a directory. It
should be the path to a file--otherwise, nanoc has no idea what to
name the output file. So, instead of "custom_path: /blog/" you could
do "custom_path: /blog/index.html".

This doesn't mean you have to explicitly link to /blog/index.html,
e.g. <a href="/blog/index.html">blog</a>. You can still link using <a
href="/blog/">blog</a>. However, when you request the path of the blog
page (like "page.path"), it will return "/blog/index.html" and not
"/blog/".

I'm not entirely sure what you are trying to do though... why not name
your blog page "blog" instead of "blog_main"? Also note that sub-pages
of the blog_main page will still have a path starting with /blog_main/
even if the blog_main page has a custom path set (unless you give all
sub-pages a custom path as well, but that's going to become messy). At
the moment, nanoc kind of expects the hierarchy of compiled pages (in
the output directory) to be the same as the hierarchy of uncompiled
pages (in the content directory).

(A bit of side information: nanoc 2.1 will improve this stuff. You'll
be able to set a custom "web" paths (e.g. "/blog/"), as well as a
"disk" path (e.g. "/blog/index.html"). Additionally, there'll be
customizable routers which are used for determining the web path and
disk path for a page.)

Hope this helps,

Denis

Reply all
Reply to author
Forward
0 new messages