You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import_ogImagefrom'~/assets/img/open-graph-banner.jpg'constconfig=useRuntimeConfig()constogImageUrl=newURL(config.public.baseUrl)// could also use https://mydomain.com/ as a string hereogImageUrl.pathname=_ogImageconstogImage=ogImageUrl.toString()useHead({meta: [{property: 'og:image',content: ogImage},]})
I describe the bug in detail below, but in short, if I access the rendered page on https://mydomain.com, and only on this page, will I get a meta tag like
Note on both localhost and the view-source pages the meta tag is rendered correctly.
Describe the bug
Short description
Okay, so I want to have open graph tags which include my domain in the path when using useHead both in my page's pre-render and when the page is rendered after being served. What I mean is I should have in my <head>
for both the pre-render, so it should display this tag on view-source:https://mydomain.com, on https://mydomain.com, and when I'm running it locally on http://localhost:3000. Unfortunately, this is not what's happening. Let me give you the displayed HTML for each of the cases
This inconsistent behavior is so frustrating, and I cannot guarantee my open graph tags will be loaded in the same way every time. On twitter, sometimes the open graph tag loads correctly, other times it will not.
Additional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered:
This is likely an inconsistency between server + client behavior. But you also don't need this on the client. Would you try using useServerHead, or just wrapping the whole set of code in if (import.meta.server) { /* */ }?
Reproductions make it possible for us to triage and fix issues quickly with a relatively small team. It helps us discover the source of the problem, and also can reveal assumptions you or we might be making.
What will happen?
If you've provided a reproduction, we'll remove the label and try to reproduce the issue. If we can, we'll mark it as a bug and prioritize it based on its severity and how many people we think it might affect.
If needs reproduction labeled issues don't receive any substantial activity (e.g., new comments featuring a reproduction link), we'll close them. That's not because we don't care! At any point, feel free to comment with a reproduction and we'll reopen it.
How can I create a reproduction?
We have a couple of templates for starting with a minimal reproduction:
Environment
Reproduction
How I'm configuring this
For my
index.vue
page, I have the following codeI describe the bug in detail below, but in short, if I access the rendered page on
https://mydomain.com
, and only on this page, will I get a meta tag likeNote on both localhost and the view-source pages the meta tag is rendered correctly.
Describe the bug
Short description
Okay, so I want to have open graph tags which include my domain in the path when using
useHead
both in my page's pre-render and when the page is rendered after being served. What I mean is I should have in my<head>
for both the pre-render, so it should display this tag on
view-source:https://mydomain.com
, onhttps://mydomain.com
, and when I'm running it locally onhttp://localhost:3000
. Unfortunately, this is not what's happening. Let me give you the displayed HTML for each of the casesview-source:https://mydomain.com
https://mydomain.com <- problems here
After the page finishes loading and I look in the console, I get
http://localhost:3000
This tag holds both in the view-source and in the dev tools console
Additional comments
This inconsistent behavior is so frustrating, and I cannot guarantee my open graph tags will be loaded in the same way every time. On twitter, sometimes the open graph tag loads correctly, other times it will not.
Additional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered: