Open rober-m opened 12 months ago
Thanks for your feedback. i tested your repo and these meta tags in the index.mdx are messing up things
og:
- title: true
- description: "POST - OG DESCRIPTION"
- image: /images/og-image.jpg
- image:alt: "POST - OG IMAGE ALT"
slug: "slug-of-the-post"
twitter:
title: "POST - TWITTER TITLE"
featured: true
tags:
- tag-1
- tag-2
- tag-3
Without them is working correctly.
Thank you, @gioboa for taking a look. Removing those tags doesn't solve the problem because I still get the following:
<meta name="twitter:card" content="Blog - publisher" q:head="" property="article:publisher">
<meta name="twitter:card" content="summary_large_image" q:head="">
Still, the example was the minimum way to reproduce the bug, but I need to set the metadata from the index.mdx
file in production because each blog post has its own.
To help with what I mean, I made small changes to the example (in a separate branch) that shows how I use the metadata in my app. Please, take a look at utils/metatada-builder.ts
and routes/(blog)/layout.tsx
Which component is affected?
Qwik City (routing)
Describe the bug
When I navigate from the main website page (in which I set meta tags using
DocumentHead
) to a blog post (in which I also set meta tags usingDocumentHead
):<a>
element to navigate, it works fine (meta tags get replaced correctly).<Link>
component fromqwik-city
, many tags change their content with other tags. Specifically, it seems that Twitter/X tags "absorb" other tags randomly. My best guess is that because Twitter/X usesname
instead ofproperty
, that breaks SPA routing somehow.Example
This is the metadata before navigating (removed clutter):
This is the metadata after navigating using
<a>
(expected result):This is the metadata after navigating using
<Link>
(unexpected result):Notice that Twitter/X tags "absorbed" other tags by taking their
property
value and replacing the original Twitter/X-relatedcontent
with thecontent
of the "absorbed"property
.Reproduction
Minimal: https://github.com/rober-m/qwik-meta-routing Closer to the real use case: https://github.com/rober-m/qwik-meta-routing/tree/closer-to-real-world
Steps to reproduce
npm i
npm run dev
<meta>
tags<meta>
tags againSystem Info
Additional Information
No response