【问题标题】:Where is {{ content }} located in the repository of a forked Jekyll repository for GitHub Pages?{{ content }} 在 GitHub Pages 的分支 Jekyll 存储库的存储库中位于何处?
【发布时间】:2014-12-22 00:49:32
【问题描述】:

这是一个位于default.html的代码sn-p,它位于存储库的master文件夹中。

  <body>
    <div class="wrapper-masthead">
      <div class="container">
        <header class="masthead clearfix">
          <a href="{{ site.baseurl }}/" class="site-avatar"><img src="{{ site.avatar }}" /></a>

          <div class="site-info">
            <h1 class="site-name"><a href="{{ site.baseurl }}/">{{ site.name }}</a></h1>
            <p class="site-description">{{ site.description }}</p>
          </div>

          <nav>
            <!-- <a href="{{ site.baseurl }}/test">Test</a> -->
            <a href="{{ site.baseurl }}/">Blog</a>
            <a href="{{ site.baseurl }}/about">About</a>
          </nav>
        </header>
      </div>
    </div>

    <div id="main" role="main" class="container">
      {{ content }}
    </div>

    <div class="wrapper-footer">
      <div class="container">
        <footer class="footer">
          {% include svg-icons.html %}
        </footer>
      </div>
    </div>

    {% include analytics.html %}
  </body>

如您所见,在&lt;div&gt; 标签的中心有一个名为{{ content }} 的Liquid 标签。

<div id="main" role="main" class="container">
  {{ content }}
</div>

我对 Liquid 标签指向的位置感到困惑。我在tutorial here 中四处寻找,但它没有说明{{ content }}、它的作用以及它的使用方式。

谁能告诉我这件事,如果可能的话,我在哪里可以找到关于{{ content }} 的更多信息以及应该如何使用它?提前致谢。

【问题讨论】:

    标签: html github jekyll liquid github-pages


    【解决方案1】:

    这是页面或帖子或其他布局的内容。

    例如:

    • index.html内容直接注入_layouts/default.html

    • about.md 被注入到 _layouts/page.html 中,它本身被注入到 _layouts/default.html 中

    只需阅读页面/帖子前端变量layout 即可了解使用了哪种布局。

    【讨论】:

    • 现在我明白了。 Jekyll 文档应该将它添加到 Front Matter 部分,但我不知道在哪里建议添加它。当我开始使用 Jekyll 时,一开始很困惑。
    猜你喜欢
    • 1970-01-01
    • 2016-02-13
    • 1970-01-01
    • 2017-04-03
    • 1970-01-01
    • 1970-01-01
    • 2018-08-02
    • 2023-03-16
    • 2018-02-20
    相关资源
    最近更新 更多