Static site doesn't generate the correct paths
jonphipps opened this issue · comments
Using DocPad 6.64.0...
I'm probably missing something, but generating a static site: docpad generate --env static
doesn't generate the necessary folders, so a file that is at http://localhost:8082/posts/hello.html
with date metadata of date: 2014-02-28
has a rewritten url in the posts
collection of http://localhost:8082/2014/02/28/hello.html
but continues to be located at its original url in the generated static site.
Oddly, it works correctly when viewing the site built using docpad run
. I confess to knowing nothing whatsoever about how DocPad generates its on-the-fly auto-refreshed version of a site, but it seems to be different from the static builder in some way.
I hope that makes sense, at least more sense than 'it's broke!'
I'm having the same issue and would appreciate knowing if this is intended.
When you are using the generate command Docpad will create folders based on the collections with a index.html at the leaf node of the folder structure. So you will end up with:
http://localhost:8082/2014/02/28/index.html
this allows you to have your web server default to load index.html enabling you to have the URL people see in the browser:
http://localhost:8082/2014/02/28/
Docpad run is much different then generate. Run Node JS is running when you are using Run producing routes based on the collections.
Hi, thanks for responding.
When you are using the generate command Docpad will create folders based on the collections
with a index.html at the leaf node of the folder structure. So you will end up with:
This file doesn't get generated for me. The static site output is identical whether or not dateurls is installed. Only the dynamic server has the date URL.
@kevincox sorry I forgot, it is https://github.com/docpad/docpad-plugin-cleanurls/ that creates the structure that I mentioned when you pass the static flag.
Add cleanurls and you should be good to go.
Excellent, I used both of the plugins but didn't have them installed at the same time :P
That produces the expected files. Thanks.
Maybe the docs could be updated about this point.