Skip to content

Commit

Permalink
♻️ refactor: only show project tag filter with 2 or more tags
Browse files Browse the repository at this point in the history
Prior to this change, the project filters would show up even with a single
tag, which wasn't very useful for filtering. Now filters only appear when
there are 2+ unique tags.
  • Loading branch information
welpo committed Nov 27, 2024
1 parent c15098a commit 180fc53
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions templates/partials/filter_card_tags.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
{% endfor %}

{#- Display unique terms -#}
{%- if all_terms -%}
{% set unique_terms = all_terms | unique | sort %}
{%- if unique_terms | length >= 2 -%}
<ul class="filter-controls" role="group" aria-label="{{ macros_translate::translate(key='project_filters', default='Project filters', language_strings=language_strings) }}">
<li class="taxonomy-item no-hover-padding">
<a id="all-projects-filter" class="no-hover-padding active"
Expand All @@ -21,7 +22,7 @@
{{- macros_translate::translate(key="all_projects", default="All projects", language_strings=language_strings) -}}
</a>
</li>
{% for term in all_terms | unique | sort %}
{% for term in unique_terms %}
<li class="taxonomy-item no-hover-padding">
<a class="no-hover-padding"
href="{{ get_taxonomy_url(kind="tags", name=term, lang=lang) }}"
Expand Down

0 comments on commit 180fc53

Please sign in to comment.