diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/app.html | 20 | ||||
| -rw-r--r-- | src/hooks.server.ts | 15 |
2 files changed, 35 insertions, 0 deletions
diff --git a/src/app.html b/src/app.html index 32cbd31e..e1f573f2 100644 --- a/src/app.html +++ b/src/app.html @@ -2,6 +2,7 @@ <html lang="en"> <head> <meta charset="utf-8" /> + <title>coinos</title> <link rel="icon" href="/favicon.ico" /> <meta name="viewport" @@ -17,6 +18,25 @@ <meta name="mobile-web-app-status-bar-style" content="black-translucent" /> <link rel="apple-touch-icon" href="/images/icon-160.png" /> <link rel="manifest" href="/manifest.webmanifest" /> + <script type="application/ld+json"> + { + "@context": "https://schema.org", + "@graph": [ + { + "@type": "WebSite", + "name": "coinos", + "url": "https://coinos.io/" + }, + { + "@type": "Organization", + "name": "coinos", + "url": "https://coinos.io/", + "logo": "https://coinos.io/images/icon-160.png", + "sameAs": ["https://x.com/coinoswallet"] + } + ] + } + </script> %sveltekit.head% </head> <body data-sveltekit-preload-data="hover"> diff --git a/src/hooks.server.ts b/src/hooks.server.ts index bd9bbc01..5e0d9e90 100644 --- a/src/hooks.server.ts +++ b/src/hooks.server.ts @@ -5,6 +5,21 @@ import type { Handle } from "@sveltejs/kit"; setIpGetter(() => ipStore.getStore()); export const handle: Handle = async ({ event, resolve }) => { + // Pages render client-side only, so the settings layout's login redirect + // never reaches crawlers; Google indexed /settings/shopify as an empty + // "Untitled" page. Redirect signed-out visitors on the server instead. + const { pathname } = event.url; + if ( + event.request.method === "GET" && + !event.cookies.get("token") && + (pathname === "/settings" || pathname.startsWith("/settings/")) && + !event.isDataRequest + ) + return new Response(null, { + status: 307, + headers: { location: `/register?redirect=${pathname}` }, + }); + const ip = event.request.headers.get("cf-connecting-ip") || event.request.headers.get("x-forwarded-for")?.split(",")[0]?.trim() || |
