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

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

    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>