Skip to content

Commit

Permalink
feat: style null URLs as disabled
Browse files Browse the repository at this point in the history
Some pages do not exist in all versions, and this translates into a null
versionUrl.
When that's the case, let us clarify the situation by disabling
corresponding menu items.

Closes #681
  • Loading branch information
greg0ire committed Feb 25, 2025
1 parent 608e9f3 commit 87c85dd
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions templates/layouts/documentation.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@
{% if version.hasDocs %}
{% set versionUrl = get_url_version(version, page.url, page.docsVersion) %}

<a class="project-version-switcher dropdown-item{% if version.slug == page.docsVersion %} active{% endif %}" href="{{ versionUrl }}">
<a class="project-version-switcher dropdown-item
{%- if version.slug == page.docsVersion %} active{% endif -%}
{%- if versionUrl is null %} disabled{% endif -%}" href="{{ versionUrl }}">
{{ version.displayName }}

{% if version.current %}
Expand All @@ -144,7 +146,9 @@
{% if version.hasDocs %}
{% set versionUrl = get_url_version(version, page.url, page.docsVersion) %}

<a class="dropdown-item{% if version.slug == page.docsVersion %} active{% endif %}" href="{{ versionUrl }}">{{ version.name }}</a>
<a class="dropdown-item
{%- if version.slug == page.docsVersion %} active{% endif -%}
{%- if versionUrl is null %} disabled{% endif -%}" href="{{ versionUrl }}">{{ version.name }}</a>
{% endif %}
{% endfor %}
{% endif %}
Expand Down

0 comments on commit 87c85dd

Please sign in to comment.