I'm following the documentation https://docs.astro.build/en/reference/api-reference/#astrourl
Where it shows you can use Astro.url + new URL() to construct a URL using your current domain.
From Docs:
---
// Example: Construct a URL for SEO meta tags using your current domain
const socialImageURL = new URL('/images/preview.png', Astro.url);
---
<meta property="og:image" content={socialImageURL} />
I've added the same method. It works locally as its resolving to localhost:3000, but I noticed on production, its still localhost:3000, not the current domain as mentioned in the docs.
I have not added Astro.site yet, because its not mentioned as mandatory to do so. Since I'm uploading to vercel, there are multiple URLs, so I want them to be based on the current domain.
Please help.
Open a New Issue