在使用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>
文档信息
- 本文作者:last2win
- 本文链接:https://last2win.com/2020/01/10/blog/
- 版权声明:自由转载-非商用-非衍生-保持署名(创意共享3.0许可证)