突出 Jekyll 本身

Highlighting Jekyll Itself

我想在我的 Jekyll 博客的代码片段上写 {{ site.url }}。但不幸的是,它在代码片段中显示了我的 username.github.io。如何避免此问题并在代码段中显示 {{ site.url }}?

为了避免 Jekyll 处理模板标签,用 {%raw%}..{%endraw%} 包围它,例如:

{% raw %}
~~~ liquid
{{ site.url }}
~~~
{% endraw %}

Raw temporarily disables tag processing. This is useful for generating content (eg, Mustache, Handlebars) which uses conflicting syntax.