Skip to content

Instantly share code, notes, and snippets.

@867
Last active March 11, 2019 06:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 867/0d52a6680459c3b79c88e7a03e6e0c66 to your computer and use it in GitHub Desktop.
Save 867/0d52a6680459c3b79c88e7a03e6e0c66 to your computer and use it in GitHub Desktop.
公式ブログ用: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