【问题标题】:Place an html file's contents in a specific part of a GitHub pages layout file将 html 文件的内容放在 GitHub 页面布局文件的特定部分
【发布时间】:2018-02-11 14:46:50
【问题描述】:

我在 GitHub 页面中使用 Jekyll,我想将整个 HTML 文件的内容放在 Jekyll 布局文件中。

这有点像 Android Studio Activity Fragment(我相信),如果您只在浏览器中查看 Fragment 代码,它将没有用处。

我想像{{ content: fragment.html }} 这样的东西,而不是当前页面的内容 ({{ content }})。

【问题讨论】:

    标签: html github layout jekyll github-pages


    【解决方案1】:

    使用这个语法:

    {% include fragment.html %}

    不要将fragment.html 包裹在<html> 元素中。

    默认情况下,您的片段文件应位于 _includes 目录 (/root/_includes/) 中。

    【讨论】:

    • 包含的文件名是相对于 repo 的根目录还是相对于 _layouts 文件夹?感谢您的回答!
    • 应该提到,你的html包含文件应该放在根目录下的_includes目录下。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-09-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多