液体警告:液体语法错误(第40行):预期的end_of_string但在/ {layouts / post.html
中的“{{page.title | truncate'110'| cgi_escape}}”中找到了字符串Liquid Exception:未定义方法line_number for“”:/ _layouts/post.html中的字符串 jekyll 3.5.0 |错误:“”:字符串
的未定义方法line_number
我不知道错误是什么,如果它是|
或缺少空格或单词。以下代码来自第40行:
<div class="article-share">
{% assign page_title = page.title | truncate '110' | cgi_escape %}
{% capture twitter-share-text %}
{{ page_title }} - {{ page.url | absolute_url }}{% if site.social.twitter %} by @{{ site.social.twitter }}{% endif %}
{% endcapture %}
整个文件/_layouts/post.html
:
<!doctype html>
<html lang="en">
{% include head.html %}
<body>
<main>
<div class="grid grid-centered">
<div class="grid-cell">
{% include navigation.html %}
<article class="article {% if site.scrollappear_enabled %}appear{% endif %}">
<header class="article-header">
<h1>{{ page.title }}</h1>
<p>{{ page.description }}</p>
<div class="article-list-footer">
<span class="article-list-date">
{{ page.date | date: "%B %-d, %Y" }}
</span>
<span class="article-list-divider">-</span>
<span class="article-list-minutes">
{% capture words %}
{{ page.content | number_of_words }}
{% endcapture %}
{% unless words contains "-" %}
{{ words | plus: 250 | divided_by: 250 | append: " minute read" }}
{% endunless %}
</span>
<span class="article-list-divider">-</span>
<div class="article-list-tags">
{% for tag in page.tags %}
<a href="{{ 'tag/' | relative_url }}{{ tag }}">{{ tag }}</a>
{% endfor %}
</div>
</div>
</header>
<div class="article-content">
{{ content }}
</div>
<div class="article-share">
{% assign page_title = page.title | truncate: 110 | cgi_escape %}
{% capture twitter-share-text %}
{{ page_title }} - {{ page.url | absolute_url }}{% if site.social.twitter %} by @{{ site.social.twitter }}{% endif %}
{% endcapture %}
<a href="https://twitter.com/home?status={{ twitter-share-text | cgi_escape }}" title="Share on Twitter" rel="noreferrer noopener" target="_blank">
<svg viewBox="0 0 512 512"><path d="M492 109.5c-17.4 7.7-36 12.9-55.6 15.3 20-12 35.4-31 42.6-53.6 -18.7 11.1-39.4 19.2-61.5 23.5C399.8 75.8 374.6 64 346.8 64c-53.5 0-96.8 43.4-96.8 96.9 0 7.6 0.8 15 2.5 22.1 -80.5-4-151.9-42.6-199.6-101.3 -8.3 14.3-13.1 31-13.1 48.7 0 33.6 17.2 63.3 43.2 80.7C67 210.7 52 206.3 39 199c0 0.4 0 0.8 0 1.2 0 47 33.4 86.1 77.7 95 -8.1 2.2-16.7 3.4-25.5 3.4 -6.2 0-12.3-0.6-18.2-1.8 12.3 38.5 48.1 66.5 90.5 67.3 -33.1 26-74.9 41.5-120.3 41.5 -7.8 0-15.5-0.5-23.1-1.4C62.8 432 113.7 448 168.3 448 346.6 448 444 300.3 444 172.2c0-4.2-0.1-8.4-0.3-12.5C462.6 146 479 129 492 109.5z"/></svg>
</a>
<a href="https://www.facebook.com/sharer/sharer.php?u={{ page.url | absolute_url }}" title="Share on Facebook" rel="noreferrer noopener" target="_blank">
<svg viewBox="0 0 512 512"><path d="M288 192v-38.1c0-17.2 3.8-25.9 30.5-25.9H352V64h-55.9c-68.5 0-91.1 31.4-91.1 85.3V192h-45v64h45v192h83V256h56.4l7.6-64H288z"/></svg>
</a>
<a href="https://plus.google.com/share?url={{ page.url | absolute_url }}" title="Share on Google+" rel="noreferrer noopener" target="_blank">
<svg viewBox="0 0 128 128"><path d="M40.7 55.9v16.1c0 0 15.6 0 22 0C59.2 82.5 53.8 88.2 40.7 88.2c-13.3 0-23.7-10.8-23.7-24.2s10.4-24.2 23.7-24.2c7.1 0 11.6 2.5 15.8 5.9 3.3-3.3 3.1-3.8 11.6-11.9 -7.2-6.6-16.8-10.6-27.4-10.6C18.2 23.3 0 41.5 0 64c0 22.5 18.2 40.7 40.7 40.7 33.6 0 41.8-29.3 39-48.8H40.7zM113.9 56.7V42.6h-10.1v14.1H89.4v10.1h14.5v14.5h10.1V66.8H128V56.7H113.9z"/></svg>
</a>
</div>
{% if site.discus_identifier %}
<div id="disqus_thread" class="article-comments"></div>
<script src="https://{{ site.discus_identifier }}.disqus.com/embed.js" async defer></script>
<noscript>Please enable JavaScript to view the comments.</noscript>
{% endif %}
</article>
{% include footer.html %}
</div>
</div>
</main>
{% include javascripts.html %}
</body>
</html>
答案 0 :(得分:0)
我认为你错过了冒号 - truncate: