Jekyll-在`index.html`

时间:2018-06-26 11:29:45

标签: jekyll liquid

我添加了要在主页上显示的视频的元数据,如下所示:

index.html:

---
layout: default
title: lorem ipsum
description: |
  loren ipsum dolor sit amet, consectetur adipiscing elit. 
  Pellentesque rutrum lacus sed quam pulvinar cursus. Fusce dictum dolor.
animVideo:
  mp4: /videos/Satoshi-intro.mp4
  webm: /videos/Satoshi-intro.webm
  ogv: /videos/Satoshi-intro.ogv
  poster: /videos/Satoshi-intro.png
(...more data)
---
{% include hero-slider.html %}
<div class="section text-center bg-gray"  id="content" >
  <div class="container">
    ...
{% include why-use-s.html %}

当我运行“ bundle exec jekyll serve”时,出现错误:

Liquid Exception: couldn't find file '' in `index.html' Checked in these paths: /var/etcetcetc ...
jekyll 3.8.1 | Error:  couldn't find file '' in `index.html'

我可以确认错误是由于上面添加的元数据animVideo引起的。没有它,该站点运行良好。但是,添加视频文件后,出现上述错误。视频文件的文件夹路径似乎正确,该路径位于根文件夹/videos/[files]上。元数据的格式似乎也很好。

我没有想法,如何进一步进行操作,如何调试和查找问题的原因,因此转向Stackoverflow。

谢谢

编辑: 根据要求,这是视频嵌入代码(我相信这里不是令人讨厌的问题。

why-use-s.html:

  <div class="container">
    {% if page.animVideo %}
    <div class="row">
      <div class="col-sm-12 text-center">
        <video id="introVideo" controls preload="auto" poster="{{ page.animVideo.poster }}">
          <source src="{{ page.animVideo.mp4 }}" type="video/mp4"/>
          <source src="{{ page.animVideo.webm }}" type='video/webm; codecs="vp8, vorbis"'/>
          <source src="{{ page.animVideo.ogv }}" type='video/ogg  codecs="theora, vorbis"' />
          <!-- Fallback object using Flow Player -->
          <object type="application/x-shockwave-flash" data="http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf"
                  width="640" height="360">
            <param name="movie" value="http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf"/>
            <param name="allowFullScreen" value="true"/>
            <param name="wmode" value="transparent"/>
            <param name="flashVars"
                   value="config={'playlist':[ '{% pic '{{ page.image }}' %}',{'url':'{{ page.animVideo.mp4 }}','autoPlay':true}]}"/>
            <img alt="My Movie" src="{{ page.animVideo.poster }}" width="640" height="360"
                 title="No video playback capabilities."/>
          </object>
          <!-- Fallback Text -->
          Your browser does not appear to support a video.
        </video>
      </div>
    </div>
 ...

这是文件夹结构,index.htmlpages文件夹中,而videos在根文件夹中: image of folder structure

1 个答案:

答案 0 :(得分:3)

没有要调试的代码,我只能猜测这个自定义标签存在问题:

{% pic '{{ page.image }}' %}

如果page.image为空,则pic标签正在寻找'',至此不存在。