Skip to content

Multiple resource tags #197

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 9, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions website/content/resources.njk
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,29 @@ permalink: resources/{{ (category | slugify) if category !== "all" }}/
<div id="resource-gallery" class="mg-item-grid mg-grid-2">
{% for resource in resources %}
{% if category in resource.tags or category === "all" %}
<a class="mg-no-link hide-external-icon" href="{{ resource.url }}" title="{{ resource.title }}">
<a class="mg-no-link hide-external-icon" href="{{ resource.url }}">
<div class="mg-resource-container mg-box-shadow"
style="background-image: url('{{ resource.cover }}');">
<div class="transparent-overlay"></div>
<div class="mg-resource-tags">
{% for tag in resource.tags %}
<div>{{ tag }}</div>
{% if loop.index <= 3 %}
<div>{{ tag }}</div>
{% endif %}
{% endfor %}

{% if resource.tags.length > 3 %}
{% set additionalTags = '' %}
{% for tag in resource.tags %}
{% if loop.index0 >= 3 %}
{% set additionalTags = additionalTags + tag + '<br/>' %}
{% endif %}
{% endfor %}
<div data-bs-toggle="tooltip" data-bs-html="true" data-bs-placement="bottom" data-bs-title="{{ additionalTags }}">
<div>+{{ resource.tags.length - 3 }}</div>
</div>
{% endif %}

</div>
<div class="mg-resource-footer">
<div class="mg-resource-title">{{ resource.title }}</div>
Expand All @@ -46,3 +61,10 @@ permalink: resources/{{ (category | slugify) if category !== "all" }}/
</div>
</section>
{% endblock %}

{% block scripts %}
<script type="text/javascript">
const tooltipTriggerList = document.querySelectorAll('[data-bs-toggle="tooltip"]');
const tooltipList = [...tooltipTriggerList].map(tooltipTriggerEl => new bootstrap.Tooltip(tooltipTriggerEl));
</script>
{% endblock %}