Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

refactor: make `linkTags` type-safe

rwlc4e8528e3dac6
diff --git a/pages/api/edge/metatags.ts b/pages/api/edge/metatags.ts
index 416d69ee84..fd1eef2df4 100644
--- a/pages/api/edge/metatags.ts
+++ b/pages/api/edge/metatags.ts
@@ -67,7 +67,13 @@ const getHeadChildNodes = (ast: ReturnType<typeof getAst>) => {
};
});
const title = ast.querySelector("title").innerText;
- const linkTags = ast.querySelectorAll("link").map((node) => node.attributes);
+ const linkTags = ast.querySelectorAll("link").map(({ attributes }) => {
+ const { rel, href } = attributes;
+ return {
+ rel,
+ href,
+ };
+ });
return { metaTags, title, linkTags };
};