Bolt CMS如何在旁边回声



我是Bolt的新手,我正在尝试理解默认主题中的一些代码,我在_aside.twig template中看到了以下代码:

{% for ct in config.get('contenttypes') if not ct.viewless|default(false) %}
            {% setcontent records = ct.slug ~ "/latest/3" %}
            <h5>{{ __('contenttypes.generic.recent', {'%contenttypes%': ct.name}) }}</h5>
            <ul>
                {% for record in records %}
                    <li><a href="{{ record.link }}">{{ record.title }}</a></li>
                {% else %}
                    <li>{{ __('contenttypes.generic.no-recent', {'%contenttype%': ct.slug}) }}</li>
                {% endfor %}
            </ul>
            <p><a href="{{ path('contentlisting', {'contenttypeslug': ct.slug}) }}">{{ __('contenttypes.generic.overview',{'%contenttypes%': ct.name}) }} &raquo;</a></p>

        {% endfor %}

我不太了解下面的代码线:

{{ __('contenttypes.generic.recent', {'%contenttypes%': ct.name}) }}

上面的代码行确实是什么,我知道它在旁边添加了标题,例如"最新文章","最近的文章",但是它如何真正起作用?

您可以在此处看到:

https://github.com/bolt/bolt/blob/66af6e450f0509a8d9d9d2c3c3c3c3c93b3e4bbd5b9c/app/app/resources/resources/translations/en_gb/messages.en_gb/messages.en_gb.yml#l89

>

这些消息是命名的,以方便横向。您提到的代码只是用实际的内容类型名称替换字符串%contenttypes%,然后打印新消息。

最新更新