-
Notifications
You must be signed in to change notification settings - Fork 14
Add check against site language to navItem language to determine href… #175
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
base: main
Are you sure you want to change the base?
Changes from 4 commits
919f2cd
b84234f
0863c00
5fb0a70
bc677ff
1f95108
934b99e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,6 +1,7 @@ | ||||||
<nav id="global-nav" aria-label="Main"> | ||||||
<div class="global-nav__inner l-center"> | ||||||
<a class="logo-link" href="{% block homepage_link %}/{% endblock %}" hreflang="{% block homepage_hreflang %}en{% endblock %}"> | ||||||
{% set siteLang %} {% block homepage_hreflang %}en{% endblock %} {% endset %} | ||||||
<a class="logo-link" href="{% block homepage_link %}/{% endblock %}" hreflang="{{ siteLang }}"> | ||||||
<span class="logo"> | ||||||
<img src="{{ absolute_url(asset('w3c/w3c-no-bars.svg', 'logos')) }}" alt="{{ 'header.logo_alt'|trans({}, 'w3c_website_templates_bundle') }}" role="img"/> | ||||||
</span> | ||||||
|
@@ -11,7 +12,9 @@ | |||||
<ul data-component="nav-double-intro"> | ||||||
{%~ for navItem in navigation %} | ||||||
<li class="top-nav-item has-children"> | ||||||
<a href="{{ navItem.titleLink }}" class="nav-link">{{ navItem.title }}</a> | ||||||
{% set langDiff = siteLang is same as navItem.targetLinkLanguage ? false : true %} | ||||||
|
{% set langDiff = siteLang is same as navItem.targetLinkLanguage ? false : true %} | |
{% set langDiff = siteLang != navItem.targetLinkLanguage %} |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like some debug information
{% if navItem.language is defined %}{{ navItem.language }}{% endif %} |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space mising:
<a href="{{ navItem.titleLink }}" class="nav-link"{% if langDiff %}hreflang="{{ navItem.targetLinkLanguage }}"{% endif %}>{{ navItem.title }}</a> | |
<a href="{{ navItem.titleLink }}" class="nav-link"{% if langDiff %} hreflang="{{ navItem.targetLinkLanguage }}"{% endif %}>{{ navItem.title }}</a> |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be simplified:
{% set childLangDiff = siteLang is same as child.targetLinkLanguage ? false : true %} | |
{% set childLangDiff = siteLang != child.targetLinkLanguage %} |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space and wrong quoting:
<a href="{{ child.url }}{% if childLangDiff %}hreflang="{{ child.targetLinkLanguage }}"{% endif %}">{{ child.title }}</a>{# -#} | |
<a href="{{ child.url }}"{% if childLangDiff %} hreflang="{{ child.targetLinkLanguage }}"{% endif %}>{{ child.title }}</a>{# -#} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the block is useful here.