【问题标题】:How to docpad generate --env static for deployment in a subdirectory如何 docpad 生成 --env static 以在子目录中部署
【发布时间】:2013-04-16 16:18:03
【问题描述】:

我确信我不是唯一一个不得不将静态站点部署到子目录的人。

事实上,我们有 www.example.com 和 mobile.example.com 以及 tablet.example.com。平板电脑和手机是主主机的子目录......所以实际上有一个重定向到 example.com/mobile 和 example.com/tablet

我正在将单独的 docpad 生成的站点部署到每个潜艇中。

能够为静态生成指定一个“基本目录”会很棒。有可能吗?

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

我使用的是最新的 docpad 版本 6.30.4

谢谢

【问题讨论】:

    标签: docpad


    【解决方案1】:

    您可以在docpad configuration file 中自定义outPath 属性以更改docpad 网站输出到的目录。有问题的属性是:

    # 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
    

    如果您想更改输出的网址,您可以按照this gist here 中的建议将您的网站网址添加到每个网址前,创建一个绝对网址。您可以通过在环境配置中设置不同来自定义站点 url。您还可以使用多个环境,例如docpad generate --env one,two

    【讨论】:

    • 我也想知道这个。此处给出的文档链接似乎已过时。当我做docpad generate --env static 时,网站输出到“out”,这很好。如果我将该目录的 contents 上传到我的 htdocs 目录,则该站点似乎可以正常工作。但是,如果我将“out”本身作为 htdocs 的子目录上传,那么一切都会被破坏。例如,我尝试在 docpadConfig 中设置 url: "http://localhost/out/",但这只能修复一些链接。
    猜你喜欢
    • 1970-01-01
    • 2013-11-14
    • 1970-01-01
    • 2015-10-04
    • 2012-09-07
    • 1970-01-01
    • 1970-01-01
    • 2016-07-30
    • 1970-01-01
    相关资源
    最近更新 更多