4

I am sure I am not the only one stuck with having to deploy a static site to a subdirectory.

in fact we have www.example.com and mobile.example.com as well as tablet.example.com. tablet and mobile are subdirectories of the main hosting... so in fact there is a redirect to example.com/mobile and example.com/tablet

i am deploying separate docpad-generated sites into each of those subs.

it would be great to be able to specify a 'base directory' for static generation. Is it possible?

LIKE: docpad generate --env static -base_path 'blahblah'

i am on the latest docpad version 6.30.4

thx

1 Answers1

2

You can customise the outPath property in your docpad configuration file to change the directory that the docpad website is outputted to. The property in question is:

# Out Path
# Where should we put our generated website files?
# If it is a relative path, it will have the resolved `rootPath` prepended to it
outPath: 'out'  # default

If you're wanting to change the urls that are outputted, you can follow the suggestion in this gist here that will prepend your site url to each url creating an absolute url. You can customise the site url by setting it different in the environment configuration. You can also use multiple environments like so docpad generate --env one,two

Steve Mc
  • 3,433
  • 26
  • 35
balupton
  • 47,113
  • 32
  • 131
  • 182
  • I'm wondering about this also. The documentation link given here seems to be outdated. When I do `docpad generate --env static` the website outputs to 'out', which is fine. If I upload the *contents* of that directory to my htdocs directory, the site seems to work. However, if I upload 'out' itself as a subdirectory of htdocs, everything is broken. I've tried setting `url: "http://localhost/out/"` for example in the docpadConfig, but this only fixes some of the links. – TonyM May 12 '15 at 07:47