我是 Lektor 的新手,我一直在我的布局中使用这个片段来动态生成菜单
{% for content in site.get('/').children %}
<li><a href="{{ content|url(alt=alt) }}">{{ content.title }}</a></li>
{% endfor %}
alt
根据所选的替代(语言)生成 url 可以正常工作,但title
仍然仅以内容的主要语言而不是翻译的语言显示。
That means that when a say french alt
is selected (and present in the url), menus are still ie Main
, Contact
instead of the french translated version.
我知道我可以使用数据包来保存菜单的语言映射来解决这个问题,但这需要复制数据包中的标题信息,然后确保它与content.title
.
理想情况下,我缺少的是一个过滤器title
,您可以在其中指定alt
要使用的过滤器,或者我不知道的其他方法?