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

fix: use absolute url for og:image tag #270

Merged
merged 4 commits into from
Sep 17, 2024

Conversation

Balastrong
Copy link
Member

Sharing https://tanstack.com/ in social networks (like linkedin) does not properly show the og:image in the preview.

See images

image

image

Our current value is /_build/assets/og-pGgYlhyc.png but it seems only absolute urls are valid.

I'm not sure this works as I cannot reliably test it locally but I'd probably give it a try.
I think other pages may be affected but let's do it step by step (or if anyone has a better solution is welcome!)

Copy link

vercel bot commented Sep 10, 2024

@Balastrong is attempting to deploy a commit to the Tanstack Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Member

@SeanCassiere SeanCassiere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On second though, maybe we should be using one of Vercel's publish URL environment variables?
https://vercel.com/docs/projects/environment-variables/framework-environment-variables

Copy link

vercel bot commented Sep 10, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
tanstack-com ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 16, 2024 2:07pm

@Balastrong
Copy link
Member Author

On second though, maybe we should be using one of Vercel's publish URL environment variables? https://vercel.com/docs/projects/environment-variables/framework-environment-variables

Agree, that would be probably more correct!
I didn't find any of those used in the codebase so I went with the hardcoded url to at least validate the fix.

Side note, do we even have those variable available? I mean NEXT_XXX while we're on a TanStack Start project.

@SeanCassiere
Copy link
Member

Side note, do we even have those variable available? I mean NEXT_XXX while we're on a TanStack Start project.

Since Start uses Vinxi, you should be able to use the same variables used for SolidStart and Vite. VITE_VERCEL_URL is probably the variable you are looking for.

@Balastrong
Copy link
Member Author

Done!

I also changed the name attribute to property for og tags as that's what meta recommends and in fact I also noticed something was missing in title/description when sharing the url so that may be one more needed fix.

Let's see what happens in the vercel preview :D

@tannerlinsley tannerlinsley merged commit 3ea6045 into TanStack:main Sep 17, 2024
2 of 3 checks passed
@Balastrong Balastrong deleted the fix/seo-image branch September 17, 2024 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants