Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
公式ブログ用:Nunjucks-news1
{% set news_category1 = '' %}
{% set news_category2 = '' %}
{% set news_amount = 5 %}
{% block contents -%}
<section>
<header>
<h2>ニュース</h2>
</header>
<ul>
{% if news_category1 == '' and news_category2 == '' -%}
{% for item in news -%}
{% if loop.index <= news_amount -%}
<li>
<dl>
<dt>{{ item.date }}</dt>
{% if item.category1 == 'ir' -%}
<dd>IR</dd>
{% elif item.category1 == 'company' -%}
<dd>企業情報</dd>
{% elif item.category1 == 'pro' -%}
<dd>製品情報</dd>
{% endif -%}
<dd><a href="{{ item.url }}">{{ item.title }}</a></dd>
</dl>
</li>
{% endif -%}
{% endfor -%}
{% endif -%}
</ul>
</section>
{%- endblock -%}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment