@@ -113,7 +113,7 @@ if (isCanonical) {
113113 is :inline
114114 slot = " head-scripts"
115115 define :vars = { { goUrl: ` /cre/${goEntry ! .id } ` , tsUrl: ` /cre/${tsEntry ! .id } ` }}
116- set :html = { ` (function(){try{var s=localStorage.getItem("docs-language-preference"),l=s==="ts "||s==='"ts "'?"ts ":"go ",u=l==="ts"?tsUrl: goUrl;u&&window.location.replace(u)}catch(e){goUrl &&window.location.replace(goUrl )}})(); ` }
116+ set :html = { ` (function(){try{var s=localStorage.getItem("docs-language-preference"),l=s==="go "||s==='"go "'?"go ":"ts ",u=l==="go"? goUrl:tsUrl ;u&&window.location.replace(u)}catch(e){tsUrl &&window.location.replace(tsUrl )}})(); ` }
117117 />
118118 ) : (
119119 goEntry &&
@@ -122,7 +122,7 @@ if (isCanonical) {
122122 is :inline
123123 slot = " head-scripts"
124124 define :vars = { { goUrl: ` /cre/${goEntry .id } ` , tsUrl: ` /cre/${tsEntry .id } ` , currentLang: entry ! .data .sdkLang }}
125- set :html = { ` (function(){try{var s=localStorage.getItem("docs-language-preference");if(s){var l=s==="ts "||s==='"ts "'?"ts ":"go ";if(l!==currentLang){var u=l==="ts"?tsUrl: goUrl;u&&window.location.replace(u)}}else{try{localStorage.setItem("docs-language-preference",currentLang)}catch(e){}}}catch(e){}})(); ` }
125+ set :html = { ` (function(){try{var s=localStorage.getItem("docs-language-preference");if(s){var l=s==="go "||s==='"go "'?"go ":"ts ";if(l!==currentLang){var u=l==="go"? goUrl:tsUrl ;u&&window.location.replace(u)}}else{try{localStorage.setItem("docs-language-preference",currentLang)}catch(e){}}}catch(e){}})(); ` }
126126 />
127127 )
128128 )
@@ -136,7 +136,7 @@ if (isCanonical) {
136136 <script
137137 type = " module"
138138 define :vars = { { goUrl: ` /cre/${goEntry .id } ` , tsUrl: ` /cre/${tsEntry .id } ` }}
139- set :html = { ` window.addEventListener("languageChanged",function(e){try{var l=e.detail.language,u=l==="ts"?tsUrl: goUrl;u&&(window.location.href=u)}catch(e){console.error("Language change error:",e)}}); ` }
139+ set :html = { ` window.addEventListener("languageChanged",function(e){try{var l=e.detail.language,u=l==="go"? goUrl:tsUrl ;u&&(window.location.href=u)}catch(e){console.error("Language change error:",e)}}); ` }
140140 />
141141 )
142142}
0 commit comments