feat(11ty): use linkTarget filter && flag object structure

This commit is contained in:
Oscar 2019-11-12 15:19:12 +01:00
parent 1295cb309b
commit 415f2aba61

View File

@ -21,28 +21,30 @@
<body> <body>
<main> <main>
{{ content | safe }} {{ content | safe }}
<section class="auto-grid"> <section>
<h2>Table of Content</h2> <h2>Table of Content</h2>
<div class="auto-grid list">
<ul> <ul>
{% for definition in collections.definitions %} {% for definition in collections.definitions %}
{% set renderedName %} {% set renderedName %}
{{ definition.data.title}} {{ definition.data.title}}
{%- if definition.data.flag and (definition.data.flag_type == 'avoid') -%} {%- if definition.data.flag and (definition.data.flag.level == 'avoid') -%}
<span class="flag__red">{{ definition.data.flag}}</span> <span class="flag__red">{{ definition.data.flag.type }}</span>
{% endif %} {% endif %}
{% endset %} {% endset %}
<li> <li>
{%- if definition.data.alt_words -%} {%- if definition.data.defined -%}
{% set linkTarget %} <a
#{{ definition.data.slug }} href={{ definition.data.slug | linkTarget | url }}
{% endset %} class="word__link"
<a href={{ linkTarget }}>{{ renderedName | safe }}</a> >{{ renderedName | safe }}</a>
{%- else -%} {%- else -%}
{{ renderedName }} {{ renderedName | safe }}
{% endif %} {% endif %}
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>
</div>
</section> </section>
<section> <section>
<h2>Words</h2> <h2>Words</h2>