Search code examples
urlroutesdocpad

How to generate custom URLs with Docpad?


I'm looking to remove redundant directories from my output URLs. This seems like it would be straightforward, but I can't seem to figure it out. Specifically:

This: .com/tmj/recipes/cocktails/rye/toronto.html

Should be more like this: .com/cocktails/rye/toronto.html

I've got a bit of a funny set up using a git submodule that requires the actual src documents to be organized a special way. Anyone know how I can get around this?


Solution

  • I was able to get the URLs I wanted by reworking the src config. This was a bit counter-intuitive to me, but now that I see it working it makes sense. Essentially I told DocPad to ignore the extra directories, and generate the site with out them. Here is the code I used, to be placed in the docpad config (docpad.coffee.)

    documentsPaths: [ # default 'documents/the-mason-jar/recipes', 'pages' ]