Skip to content

Commit

Permalink
Merge pull request #11 from companieshouse/feature/add-hreflang
Browse files Browse the repository at this point in the history
add attribute hreflang to <a href>
  • Loading branch information
sbasile-ch authored Aug 8, 2024
2 parents 5787fca + 1cf13d3 commit 693c69a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions templates/locales-banner.njk
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ It receives:
{% if lang and lang == l.IsoCode %}
<span class="govuk-body-s govuk-!-margin-2">{{ l.Name }}</span>
{% else %}
<a href="{{ lang2url.addLangToUrl(currentUrl, l.IsoCode, true) }}" lang="{{ l.IsoCode }}" rel="alternate" class="govuk-link govuk-!-margin-2 language-link">
<a href="{{ lang2url.addLangToUrl(currentUrl, l.IsoCode, true) }}"
lang="{{ l.IsoCode }}"
hreflang="{{ l.IsoCode }}"
rel="alternate"
class="govuk-link govuk-!-margin-2 language-link"
>
<span>{{ l.Name }}</span>
</a>
{% endif %}
Expand All @@ -33,7 +38,7 @@ It receives:
<script>
document.addEventListener('DOMContentLoaded', function() {
const languageLinks = document.querySelectorAll('.language-link');
languageLinks.forEach(link => {
link.addEventListener('click', function(event) {
const language = this.getAttribute('lang');
Expand Down

0 comments on commit 693c69a

Please sign in to comment.