Skip to content

Commit 87c85dd

Browse files
committed
feat: style null URLs as disabled
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
1 parent 608e9f3 commit 87c85dd

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

templates/layouts/documentation.html.twig

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,9 @@
122122
{% if version.hasDocs %}
123123
{% set versionUrl = get_url_version(version, page.url, page.docsVersion) %}
124124

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

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

147-
<a class="dropdown-item{% if version.slug == page.docsVersion %} active{% endif %}" href="{{ versionUrl }}">{{ version.name }}</a>
149+
<a class="dropdown-item
150+
{%- if version.slug == page.docsVersion %} active{% endif -%}
151+
{%- if versionUrl is null %} disabled{% endif -%}" href="{{ versionUrl }}">{{ version.name }}</a>
148152
{% endif %}
149153
{% endfor %}
150154
{% endif %}

0 commit comments

Comments
 (0)