2017-01-11 7 views
1

Я нажал обновление на моем сайте Github Pages, и он не смог выполнить сборку. Локально он строит просто отлично.Недействительная дата при построении на страницах Github

Repo: https://github.com/valeIT/valeIT.github.io/

The page build failed with the following error:

The value 'nil' was passed to a date-related filter that expects valid dates in /_layouts/post.html or one of its layouts. For more information, see https://help.github.com/articles/page-build-failed-date-is-not-a-valid-datetime/ .

For information on troubleshooting Jekyll see:

https://help.github.com/articles/troubleshooting-jekyll-builds

Я посмотрел на «/_layouts/post.html», но мое знание жидкости является довольно простой и не мог видеть ничего плохого в этом.

Содержание post.html:

--- 
--- 
<!DOCTYPE html> 
<html> 
    {% include head.html %} 
    <body itemscope itemtype="http://schema.org/Article"> 
    {% include header.html %} 
    <main class="content" role="main"> 
     <article class="post"> 
     {% if page.image %} 
     <div class="article-image"> 
      <div class="post-image-image" style="background-image: url({% if page.image %}{{ page.image }}{% endif %})"> 
      Article Image 
      </div> 
      <div class="post-image-image2" style="background-image: url({% if page.image2 %}{{ page.image2 }}{% endif %})"> 
      Article Image 
      </div> 
      <div class="post-meta"> 
      <h1 class="post-title">{{ page.title }}</h1> 
      <div class="cf post-meta-text"> 
       <div class="author-image" style="background-image: url({{ site.author_image }})">Blog Logo</div> 
       <h4 class="author-name" itemprop="author" itemscope itemtype="http://schema.org/Person">{{ site.author }}</h4> 
       on 
       <time datetime="{{ page.date | date: "%F %R" }}">{{ page.date | date_to_string }}</time> 
       <!-- , tagged on {{#foreach tags}}<span class="post-tag-{{slug}}">{{#if @first}}{{else}}, {{/if}}<a href="/tag/{{slug}}">{{name}}</a></span>{{/foreach}} --> 
       - {{ page.content | number_of_words }} Words - {{ content | reading_time_as_i }}. 
      </div> 
      <div style="text-align:center"> 
       <a href="#topofpage" class="topofpage"><i class="fa fa-angle-down"></i></a> 
      </div> 
      </div> 
     </div> 
     {% else %} 
     <div class="noarticleimage"> 
      <div class="post-meta"> 
      <h1 class="post-title">{{ page.title }}</h1> 
      <div class="cf post-meta-text"> 
       <div class="author-image" style="background-image: url({{ site.author_image }})">Blog Logo</div> 
       <h4 class="author-name" itemprop="author" itemscope itemtype="http://schema.org/Person">{{ page.author }}</h4> 
       on 
       <time datetime="{{ page.date | date_to_xmlschema }}">{{ page.date | date_to_string }}</time> 
       <!-- , tagged on {{#foreach tags}}<span class="post-tag-{{slug}}">{{#if @first}}{{else}}, {{/if}}<a href="/tag/{{slug}}">{{name}}</a></span>{{/foreach}} --> 
      </div> 
      </div> 
     </div> 
     <br> 
     <br> 
     <br> 
     {% endif %} 
     <section class="post-content"> 
      <div class="post-reading"> 
      <span class="post-reading-time"></span> read 
      </div> 
      <a name="topofpage"></a> 
      {{content}} 
     </section> 
     <footer class="post-footer"> 
      <section class="share"> 
      {% for social in site.social %} 
       {% if social.share_url != null %} 
       <a class="icon-{{ social.icon }}" href="{{ social.share_url }}{{ social.share_title }}{{page.title | cgi_escape}}{{ social.share_link }}{{site.url}}{{page.id}}" 
        onclick="window.open(this.href, '{{ social.icon }}-share', 'width=550,height=255');return false;"> 
       <i class="fa fa-{{ social.icon }}"></i><span class="hidden">{{ social.icon }}</span> 
       </a> 
       {% endif %} 
      {% endfor %} 
      </section> 
     </footer> 
     <div class="bottom-teaser cf"> 
      <div class="isLeft"> 
      <h5 class="index-headline featured"><span>Written by</span></h5> 
      <section class="author"> 
       <div class="author-image" style="background-image: url({{site.author_image}})">Blog Logo</div> 
       <h4>{{ site.author }}</h4> 
       <p class="bio">{{author.bio}}</p> 
       <hr> 
       <p class="published">Published <time datetime="{{ page.date | date: "%F %R" }}">{{ page.date | date_to_string }}</time></p> 
      </section> 
      </div> 
      {{/post}} 
      <div class="isRight"> 
      <h5 class="index-headline featured"><span>Supported by</span></h5> 
      <footer class="site-footer"> 
       <section class="poweredby"><a href ="{{site.url}}/apps">Check Out My Apps</a></section> 
       <a class="subscribe" href="{{ "/feed.xml" | prepend: site.baseurl }}"> <span class="tooltip"> <i class="fa fa-rss"></i> You should subscribe to my feed.</span></a> 
       <div class="inner"> 
       <section class="copyright">All content copyright <a href="{{@blog.url}}/">{{site.author}}</a> &copy; {{ site.time | date: '%Y' }}<br>All rights reserved.</section> 
       </div> 
      </footer> 
      </div> 
     </div> 
     {%if site.disqus %} 
     <div id="disqus_thread"></div> 
     <script type="text/javascript"> 
      /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */ 
      var disqus_shortname = '{{site.disqus}}'; // required: replace example with your forum shortname 
      /* * * DON'T EDIT BELOW THIS LINE * * */ 
      (function() { 
       var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; 
       dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js'; 
       (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); 
      })(); 
     </script> 
     <noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript> 
     {% endif %} 
     </article> 
    </main> 
    <div class="bottom-closer"> 
     <div class="background-closer-image" {%if site.cover %} style="background-image: url({{ site.cover }})"{% endif %}> 
     Image 
     </div> 
     <div class="inner"> 
     <h1 class="blog-title">{{ site.title }}</h1> 
     <h2 class="blog-description">{{ site.description }}</h2> 
     <a href="/" class="btn">Back to Overview</a> 
     </div> 
    </div> 
    {% include javascripts.html %} 
    </body> 
</html> 

Любая идея?

ответ

1

Это не удается, потому что

The value 'nil' was passed to a date-related filter

Это означает, что в макете сообщений, вы, вероятно, обработку, не публикуйте содержание с layout: post, например, страницей, которая не содержит date значения в их титульных (содержание между --- вверху).

Тогда код, подобный <time datetime="{{ page.date | date_to_xmlschema }}">{{ page.date | date_to_string }}</time>, потерпит неудачу, потому что вы проходите '' до date_to_string фильтра.

У вас есть два варианта:

  • идентифицировать страницы с неправильным layout: post атрибута и изменить их layout: page
  • сделать код более безопасным проверки, если дата не является NIL перед отправкой его значение в качестве фильтра, например, с выше time тегом, проверьте date содержит дату первый:

    {% if page.date %} 
    <time datetime="{{ page.date | date_to_xmlschema }}">{{ page.date | date_to_string }}</time> 
    {% endif %} 
    

Кроме того, когда Джекилла генерирует сайт локально, он показывает много предупреждений, как:

Liquid Warning: Liquid syntax error (line 76): Unexpected character/in "{{/post}}" in /_layouts/post.html 
Liquid Warning: Liquid syntax error (line 79): Unexpected character/in "{{!! After all the posts, we have the previous/next pagination links }}" in index.html 

Вы должны удалить эти слэши {{/posts}} к {{posts}}, и другие символы, такие как @ и # внутри жидких тегов.