【问题标题】:Where is "root_url" in Octopress?Octopress 中的“root_url”在哪里?
【发布时间】:2012-09-14 03:44:04
【问题描述】:

也许这是某种 Jekyll 设置或其他东西,但我需要将 root_url 设置为“/”以外的其他东西,我不知道在哪里做。

【问题讨论】:

    标签: jekyll octopress


    【解决方案1】:

    .themes/classic/source/_layouts/default.html 文件中,有{% capture root_url %}{{ site.root | strip_slash }}{% endcapture %}

    site.root_config.yml 中配置,默认为root: /

    如果您使用 jekyll 本地开发的默认设置 http://127.0.0.1:4000/ 进行测试,您可以将其更改为 root: http://127.0.0.1:4000/。那么路径将是正确的。例如,<link href="{{ root_url }}/favicon.png" rel="icon"> 将被解析为<link href="http://127.0.0.1:4000//favicon.png" rel="icon">

    简而言之,在_config.yml 中更改root: / 行即可。

    【讨论】:

      【解决方案2】:

      抱歉问得太快了。您可以在 _config.yml 中找到设置。我以为我在那里检查过,但我必须两次打开另外两个配置文件之一。

      【讨论】:

      • 这是根:不是 root_url:.
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-09-10
      • 2012-07-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-09-21
      • 1970-01-01
      相关资源
      最近更新 更多