【问题标题】:jekyll liquid directives not processed in github-pages main index.html; what am I missing?github-pages main index.html 中未处理 jekyll 液体指令;我错过了什么?
【发布时间】:2015-04-16 08:39:13
【问题描述】:

新手问题。我正在尝试开始使用 github-pages 和 Jekyll,按照自己的方式阅读文档。我得到了这个:http://jekyllrb.com/docs/posts/#displaying-an-index-of-posts,我想我会将 Liquid 指令直接放入我的主 index.html 中,但它们没有得到处理。相反,他们只是逐字逐句地出来:

<ul>
  {% for post in site.posts %}
    <li><a href="{{ post.url }}">{{ post.title }}</a></li>
  {% endfor %}
</ul>

(很明显,HTML 不是逐字输出的,但 Liquid 的东西会。)

我的目录结构(使用github自动页面生成器创建):

./   Gemfile       .git/       images/     javascripts/  _posts/  stylesheets/
../  Gemfile.lock  .gitignore  index.html  params.json   _site/

宝石文件:

source 'https://rubygems.org'

require 'json'
require 'open-uri'
versions = JSON.parse(open('https://pages.github.com/versions.json').read)

gem 'github-pages', versions['github-pages']

我运行过bundle installbundle update。我确实有一个帖子。

bundle exec jekyll serve 一切正常,除了这个错误/警告:

Configuration file: none

我错过了什么?

(谢谢。)

【问题讨论】:

标签: jekyll liquid github-pages


【解决方案1】:

好的,所以... 原来你所需要的只是在你的 index.html 中加入“front matter”,以触发 Jekyll (http://jekyllrb.com/docs/frontmatter/) 的处理。最小的前题是两行三个破折号,这对我有用。

进入下一个障碍!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-12-29
    • 2014-01-25
    • 1970-01-01
    • 1970-01-01
    • 2020-07-08
    • 2013-12-16
    • 1970-01-01
    • 2018-01-03
    相关资源
    最近更新 更多