Skip to content
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

Multiple languages links if using locale_links filter and pagination #3555

Open
stebrech opened this issue Nov 23, 2024 · 0 comments
Open

Multiple languages links if using locale_links filter and pagination #3555

stebrech opened this issue Nov 23, 2024 · 0 comments

Comments

@stebrech
Copy link

Operating system

macOS 13.7.1

Eleventy

3.0.0

Describe the bug

Using pagination and the builtin EleventyI18nPlugin the language switcher has multiple of the same language. The amount of language links is related to the amount of paginated pages.

My code of the language switch looks like this:

<ul id="lang-switcher">
	<li class="lang-switch current">
		<a href="{{ page.url }}" lang="{{ page.lang }}" hreflang="{{ page.lang }}">
			{{ page.lang | upper }}
		</a>
	</li>

	{% for link in page.url | locale_links %}
		<li class="lang-switch">
			<a href="{{ link.url }}" lang="{{ link.lang }}" hreflang="{{ link.lang }}">
				{{ link.lang | upper }}
			</a>
		</li>
	{% endfor %}
</ul>

Reproduction steps

  1. Use the documented code to create a language switcher https://www.11ty.dev/docs/plugins/i18n/#this-page-also-available-in-example
  2. Use a pagination page. There must be enough data to create multiple paginated pages.

Expected behavior

The language switcher should only have one entry per language.

Reproduction URL

No response

Screenshots

No response

stebrech added a commit to stebrech/stebre-site that referenced this issue Nov 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant