Skip to content

Commit

Permalink
fix: redirects from non canonical
Browse files Browse the repository at this point in the history
  • Loading branch information
jamerrq committed Dec 2, 2024
1 parent 1e191e8 commit f51971f
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/components/head/scripts.astro
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@ const blob = rawBlobs.at(index)!
// @ts-ignore
import { pwaInfo } from 'virtual:pwa-info'
const url = Astro.url
const isInDeno = url.toString().includes('.deno.dev')
const astroURL = Astro.url.toString()
const isInDeno = astroURL.includes('.deno.dev')
---

<!-- Redirect to jamerrq.dev if in deno -->
<script is:inline define:vars={{ isInDeno }}>
<!-- Redirect to canon if needed -->
<script is:inline define:vars={{ isInDeno, astroURL }}>
if (isInDeno) {
window.location.href = 'https://jamerrq.dev'
const canonURL = astroURL.replace('.deno.dev', '.dev')
window.location.href = canonURL
}
</script>

Expand Down

0 comments on commit f51971f

Please sign in to comment.