报错解决--Liquid Warning-- Liquid syntax error (line 2) Expected dotdot but found id in "{{(site.github.public_repositories sort

2020/01/10 行走的问题解决机 共 802 字,约 3 分钟

在使用GitHub Pages博客– Jekyll搭建了自己的博客后,遇到了报错:

    Liquid Warning: Liquid syntax error (line 2): Expected dotdot but found id in "{{(site.github.public_repositories sort: 'stargazers_count') reverse }}" in pages/open-source.md
    Liquid Warning: Liquid syntax error (line 35): Expected end_of_string but found id in "{{ repo.updated_at date: '%Y-%m-%d' }}" in pages/open-source.md

这是因为2年过去了,我用的旧的模板有问题,修改代码即可。 原代码:

{% if site.github.public_repositories != null %}
{% assign sorted_repos = (site.github.public_repositories    sort: 'stargazers_count'  )reverse %}
<time datetime="{{ repo.updated_at }}">{{ repo.updated_at    date: '%Y-%m-%d' }}</time>

修改后的代码:

{% if site.github.public_repositories != null %}
{% assign sorted_repos = site.github.public_repositories  |  sort: 'stargazers_count'|    reverse %}
<time datetime="{{ repo.updated_at }}">{{ repo.updated_at |   date: '%Y-%m-%d' }}</time>

文档信息

Table of Contents