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

Allow users to add hreflang attribute for Internationalization #7877

Open
milindmore22 opened this issue Sep 6, 2024 · 2 comments
Open

Allow users to add hreflang attribute for Internationalization #7877

milindmore22 opened this issue Sep 6, 2024 · 2 comments
Labels
Enhancement New feature or improvement of an existing one

Comments

@milindmore22
Copy link
Collaborator

Feature Description

AMP currently does not support the hreflang attribute on <link> tags with the attribute. This allows users to add internationalization to AMP pages to effectively and target specific language or regional audiences.

I will suggest adding a filter which will allow programs and users to customize the attribute as per thier requirements.

ref: https://amp.dev/documentation/examples/websites/guides/internationalization/

Acceptance Criteria

No response

Implementation Brief

No response

QA Testing Instructions

No response

Demo

No response

Changelog Entry

No response

@milindmore22 milindmore22 added the Enhancement New feature or improvement of an existing one label Sep 6, 2024
@westonruter
Copy link
Member

@milindmore22 Looking at the rules in that doc:

  1. Every canonical document must have a link tag with rel=amphtml pointing to its matching AMP document in the same language.
  2. Every AMP document must have a link tag with rel=canonical pointing to its matching canonical desktop document, again, in the same language.
  3. Every canonical document must have a link tag with rel=alternate and an hreflang attribute for each alternative language version of the canonical document.
  4. Every AMP document must have a link tag with rel=alternate and an hreflang attribute for each alternative language version of the AMP document.

We currently are doing (1) and (2). However, for (3) and (4) these are actually additional link tags, correct? So then do we actually need any filter at all? And what I mentioned to you about needing to remove_action() in the support topic actually is incorrect, right?

@milindmore22
Copy link
Collaborator Author

milindmore22 commented Sep 9, 2024

Hello @westonruter yes. that's correct we also don't have to add hreflang attribute if there are rel=alternate are added.

      <link rel="alternate" href="https://amp.dev/static/samples/internationalization/alternate/index.mobile.html" />
      <link rel="alternate" hreflang="en" href="https://amp.dev/static/samples/internationalization/alternate/" />
      <link rel="alternate" hreflang="fr" href="https://amp.dev/static/samples/internationalization/alternate/fr/" />
      <link rel="alternate" hreflang="ja" href="https://amp.dev/static/samples/internationalization/alternate/ja/" />```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or improvement of an existing one
Projects
None yet
Development

No branches or pull requests

2 participants