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

invalid link for opengraph-image when using mode as-needed and prefixes #1657

Closed
3 tasks done
sss-Mihail-sss opened this issue Jan 10, 2025 · 1 comment · Fixed by #1658
Closed
3 tasks done

invalid link for opengraph-image when using mode as-needed and prefixes #1657

sss-Mihail-sss opened this issue Jan 10, 2025 · 1 comment · Fixed by #1658
Labels
bug Something isn't working unconfirmed Needs triage.

Comments

@sss-Mihail-sss
Copy link

Description

The og:image link is incorrectly generated when using language prefixes from the next-intl package. For Spanish (/es), the link is formed as /es/opengraph-image, but it should be /spain/opengraph-image. This causes a 404 error when the link is accessed.

Verifications

Mandatory reproduction URL

https://github.com/amannn/next-intl/tree/main/examples/example-app-router-playground

Reproduction description

Steps to Reproduce:

  1. Open the project with the es language using this link: localhost:3001/spain.
  2. Open the DevTools or any extension to check the SEO metadata.
  3. Observe the og:image link.
  4. When the link is opened, it changes to /es/spain and results in a 404 error.

Actual Behavior:

For Spanish, the link to og image /es/opengraph-image when opened redirects to /spain/es/opengraph-image, resulting in a 404 error.

Examples:

  1. Default language (working) :

    • Open Graph Meta
      image
    • Open Link
      image
  2. Spanish Language (not working):

    • Open Graph Meta
      image
    • Open Link
      image

Expected behaviour

For Spanish, link to opengraph-image should be /spain/opengraph-image

Example for correct link /spain/opengraph-image
image

@amannn
Copy link
Owner

amannn commented Jan 10, 2025

Thanks for noticing! I've adapted the example in #1658 to work correctly and have also added a paragraph to the docs about this case. Let me know if this helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working unconfirmed Needs triage.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants