{"version":3,"file":"HreflangTags.DZllAx3L.mjs","names":[],"sources":["https:/framerusercontent.com/modules/z6NgfN3wMLuzIfXmoZ9C/woKDXOKzOiGYFIxRSP3t/HreflangTags.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * Injects hreflang <link> tags into the page <head> for multilingual SEO.\n * Place on inner page templates (journal/:slug, courses/:slug, etc.)\n * to tell Google which language/region each URL serves.\n *\n * When placed on the /quiz page on my-temple.com, it fires a full-page\n * redirect so Cloudflare can route to the Vercel quiz app.\n * The redirect is intentionally skipped on Framer staging/preview domains.\n *\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function HreflangTags(props){useEffect(()=>{// Only redirect on the live site — not in Framer staging/preview\nconst isLiveSite=window.location.hostname.endsWith(\"my-temple.com\");if(isLiveSite&&window.location.pathname===\"/quiz\"){// Use href assignment with a cache-buster param so the browser sees\n// a different URL than the Framer SPA pushed via history.pushState.\n// window.location.reload() doesn't work reliably after pushState.\n// Next.js middleware strips ?r=1 and redirects to /quiz cleanly.\nwindow.location.href=\"https://my-temple.com/quiz?r=1\";return;}document.querySelectorAll('link[data-hreflang-component=\"true\"]').forEach(el=>el.remove());const baseUrl=\"https://my-temple.com\";const currentPath=window.location.pathname;const isSv=currentPath.startsWith(\"/sv/\")||currentPath===\"/sv\";const enPath=props.enPath||(isSv?currentPath.replace(/^\\/sv/,\"\")||\"/\":currentPath);const enUrl=`${baseUrl}${enPath}`;const addLink=(rel,hreflang,href)=>{const link=document.createElement(\"link\");link.rel=rel;link.setAttribute(\"hreflang\",hreflang);link.setAttribute(\"href\",href);link.setAttribute(\"data-hreflang-component\",\"true\");document.head.appendChild(link);};addLink(\"alternate\",\"en\",enUrl);addLink(\"alternate\",\"x-default\",enUrl);if(props.includeSv!==false){const svPath=props.svPath||(isSv?currentPath:`/sv${currentPath}`);const svUrl=`${baseUrl}${svPath}`;addLink(\"alternate\",\"sv\",svUrl);}return()=>{document.querySelectorAll('link[data-hreflang-component=\"true\"]').forEach(el=>el.remove());};},[props.enPath,props.svPath,props.includeSv]);return /*#__PURE__*/_jsx(\"div\",{style:{display:\"none\"}});}addPropertyControls(HreflangTags,{includeSv:{type:ControlType.Boolean,title:\"Include Swedish\",defaultValue:false,description:\"Add sv hreflang (only if a Swedish version exists)\"},enPath:{type:ControlType.String,title:\"EN Path\",defaultValue:\"\",description:\"Override English path, e.g. /journal/my-article. Auto-detected from URL if blank.\"},svPath:{type:ControlType.String,title:\"SV Path\",defaultValue:\"\",description:\"Override Swedish path, e.g. /sv/journal/my-article. Auto-detected if blank.\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"HreflangTags\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any\",\"framerSupportedLayoutWidth\":\"any\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./HreflangTags.map"],"mappings":"wLAWG,SAAwB,EAAa,EAAM,CAKs+B,OALr+B,MAAc,CACO,GAAnD,EAAO,SAAS,SAAS,SAAS,gBAAgB,EAAgB,EAAO,SAAS,WAAW,QAAQ,CAItH,EAAO,SAAS,KAAK,iCAAiC,OAAQ,SAAS,iBAAiB,uCAAuC,CAAC,QAAQ,GAAI,EAAG,QAAQ,CAAC,CAAC,IAAM,EAAQ,wBAA8B,EAAY,EAAO,SAAS,SAAe,EAAK,EAAY,WAAW,OAAO,EAAE,IAAc,MAA+F,EAAM,GAAG,IAArF,EAAM,SAAS,EAAK,EAAY,QAAQ,QAAQ,GAAG,EAAE,IAAI,KAAqD,GAAS,EAAI,EAAS,IAAO,CAAC,IAAM,EAAK,SAAS,cAAc,OAAO,CAAC,EAAK,IAAI,EAAI,EAAK,aAAa,WAAW,EAAS,CAAC,EAAK,aAAa,OAAO,EAAK,CAAC,EAAK,aAAa,0BAA0B,OAAO,CAAC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