在表示之前或之后,未将语言定义数据yml的插入解析为另一个数据文件。
我尝试使用液体标签。
前端代码演示
<div class="small-6 medium-3 large-3 columns">
{% for network_item in site.data.network %}
{% if forloop.first == true %}
<h5 class="shadow-black">{{ network_item.menu_name }}</h5>
{% endif %}
{% endfor %}
这是network.yml的数据文件,仍然是WIP:
- menu_name: "{{ site.data.language.menu_name }}"
- name: "Icons by Daniel Bruce"
url: "http://entypo.com/"
class: "network-entypo"
title: "Icons by Daniel Bruce"
- name: "Built on Foundation"
url: "http://foundation.zurb.com/"
class: "services-newsletter"
title: "Built on Foundation"
- name: "Images by Unsplash"
url: "http://unsplash.com/"
class: "rss-link"
title: "Images by Unsplash"
- name: "Using Backstretch by Scott Robbin"
url: "http://srobbin.com/jquery-plugins/backstretch/"
class: "sitemap-link"
title: "Using Backstretch by Scott Robbin"
这是language.yml中的语言项目
menu_name: "Credits"
在前端渲染的代码中,我得到的标题是:
{{ SITE.DATA.LANGUAGE.MENU_NAME }}
这应该是语言定义,这样我才能使该主题变为多语言。