How to change generated files output path in Docpad?

433 Views Asked by At

I want to do something like what docpad-plugin-dateurls does but in the context of static site generation.

I need, for example, to map the file /src/documents/posts/2013-09-10-post-title.html to the url http://localhost:9778/posts/2013/09/10/post-title.html

Which would be the best approach to acomplish this requirement?

2

There are 2 best solutions below

0
On BEST ANSWER

I finally implemented this by setting the outPath of each document in the renderBefore event. See here: https://github.com/gschuager/blog/blob/7451fbcb829ad93154d24b281c7e8e30d3a0edac/docpad.js#L83

5
On

You would do something like this: https://github.com/Greduan/eduantech.docpad/blob/d5e97638331ab24730d3331b9fbcc30cf1d46dcc/docpad.coffee#L45-L49

You would modify it for your needs but it does what you need I think. :)