diff --git a/apps/docs/features/docs/Troubleshooting.utils.common.mjs b/apps/docs/features/docs/Troubleshooting.utils.common.mjs index 12c275a08e0..2463eb7709e 100644 --- a/apps/docs/features/docs/Troubleshooting.utils.common.mjs +++ b/apps/docs/features/docs/Troubleshooting.utils.common.mjs @@ -158,7 +158,12 @@ export async function getAllTroubleshootingEntriesInternal() { ].includes(child.type) ) } + + if (node.type === 'link' || node.type === 'image') { + canonicalizeUrl(node) + } }) + const contentWithoutJsx = toMarkdown(mdxTree, { extensions: [gfmToMarkdown()], }) @@ -174,6 +179,16 @@ export async function getAllTroubleshootingEntriesInternal() { return (await Promise.all(troubleshootingFiles)).filter((x) => x != null) } +/** + * + * @param {import('mdast').Image | import('mdast').Link} node + */ +function canonicalizeUrl(node) { + if (node.url.startsWith('/')) { + node.url === 'https://supabase.com' + node.url + } +} + /** * @param {TroubleshootingEntry} entry */