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
{{ message }}
This repository has been archived by the owner on Dec 31, 2022. It is now read-only.
I've ran into various use cases where the og:image does not reference the actual path in the public folder.
It...
Doesn't take the locale into account, e.g. when I'm on /docs with a locale set to en, it will generate the following: <meta property="og:image" content="contoso.com/next-banner-generated/docs..."/> instead of <meta property="og:image" content="contoso.com/next-banner-generated/en/docs..."/> which is where the generated images get placed.
So it should either
Place the images at the root, /docs.jpg instead of /en/docs.jpg in this case.
Include the locale.
Doesn't strip the trailing slash (next.config trailingSlash), aka it will render <meta property="og:image" content="contoso.com/next-banner-generated/docs/.jpg"/>
while this should be content="contoso.com/next-banner-generated/docs.jpg"
The text was updated successfully, but these errors were encountered:
jariz
changed the title
bug: NextBannerMeta references a og:image in various situations
bug: NextBannerMeta references a incorrect og:image in various situations
Jun 4, 2022
Adding support for locale seems like a great idea, I suppose adding the locale always is better in case the images should have different langs too. But the example code does not work for index cases. For my example folder, the / route generated next-banner-alvarlagerlof.vercel.app/next-banner-generated.jpg.
The explicit / to index is needed to not have folder.jpg. Maybe this instead?
let url = `${domain}/${outputDir}`;
if (locale) {
url += `/${locale}`;
}
url += asPath;
// remove #anchors
url = url.replace(/#[a-zA-Z-]*/, "");
// add "index" to if on root page
if (asPath === "/") {
url.slice(0, -1);
url += "index";
}
url += ".jpg";
I've ran into various use cases where the og:image does not reference the actual path in the public folder.
It...
/docs
with a locale set toen
, it will generate the following:<meta property="og:image" content="contoso.com/next-banner-generated/docs..."/>
instead of<meta property="og:image" content="contoso.com/next-banner-generated/en/docs..."/>
which is where the generated images get placed.So it should either
/docs.jpg
instead of/en/docs.jpg
in this case.<meta property="og:image" content="contoso.com/next-banner-generated/docs/.jpg"/>
while this should be
content="contoso.com/next-banner-generated/docs.jpg"
The text was updated successfully, but these errors were encountered: