The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Improve metatags API implementation to take the first instance of a metatags
Steven Tey969951296b71
diff --git a/apps/web/app/api/metatags/utils.ts b/apps/web/app/api/metatags/utils.tsindex 385be66270..f8051ea10d 100644--- a/apps/web/app/api/metatags/utils.ts+++ b/apps/web/app/api/metatags/utils.ts@@ -63,13 +63,15 @@ export const getMetaTags = async (url: string) => {for (let k in metaTags) {let { property, content } = metaTags[k];- property && (object[property] = content && he.decode(content));+ // !object[property] → (meaning we're taking the first instance of a metatag and ignoring the rest)+ property && !object[property] && (object[property] = content && he.decode(content));}for (let m in linkTags) {let { rel, href } = linkTags[m];- rel && (object[rel] = href);+ // !object[rel] → (ditto the above)+ rel && !object[rel] && (object[rel] = href);}const title = object["og:title"] || object["twitter:title"] || titleTag;