Twig Pico CMS 2.0中的社交元标记是如何工作的?
我看到PicoCMS2.0中有一些管理社交信息(Facebook等)的代码,但我找不到任何示例。代码示例的细枝文件中包含以下内容:Twig Pico CMS 2.0中的社交元标记是如何工作的?,twig,Twig,我看到PicoCMS2.0中有一些管理社交信息(Facebook等)的代码,但我找不到任何示例。代码示例的细枝文件中包含以下内容: {% for social in pages._meta.meta.social %} <a href="{{ social.url }}" title="{{ social.title }}" role="button"> <span class="icon-{{ social.icon }}" aria-hidden="
{% for social in pages._meta.meta.social %}
<a href="{{ social.url }}" title="{{ social.title }}" role="button">
<span class="icon-{{ social.icon }}" aria-hidden="true"></span>
<span class="sr-only">{{ social.title }}</span>
</a>
{% endfor %}
呃,这只是一个复制/粘贴问题。PicoCMS对元子项之前的空格数非常挑剔 虚线子项前需要有四个空格,其他子项前需要有六个空格。任何其他价值观似乎只是让社交项目无法运作。因此,答案是:
---
social:
- title: Visit us on Facebook
url: https://example.com/sallysflowers
icon: facebook
- title: Check us out on Twitter
url: https://example.com/sallyflora
icon: twitter
- title: Contact us by Email!
url: mailto:sallysflowershop@example.com
icon: mail
---
请注意,社交图标是使用Fontello创建的,图标调用是在themes/default/css/Fontello.css
中定义的,它也使用themes/default/icon/*
文件
---
social:
- title: Visit us on Facebook
url: https://example.com/sallysflowers
icon: facebook
- title: Check us out on Twitter
url: https://example.com/sallyflora
icon: twitter
- title: Contact us by Email!
url: mailto:sallysflowershop@example.com
icon: mail
---