Skip to content

Commit a1076c1

Browse files
committed
og tags
1 parent eed8289 commit a1076c1

File tree

3 files changed

+35
-2
lines changed

3 files changed

+35
-2
lines changed

frontend/src/routes/+layout.svelte

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,19 @@
88
const props = $props();
99
let { children, data } = props;
1010
11+
const SITE_TITLE = 'rustytime';
12+
const SITE_DESCRIPTION = 'Blazingly fast time tracking for developers.';
13+
const SITE_URL = 'https://rustytime.shymike.dev';
14+
15+
const ogImagePath = favicon.startsWith('/') ? favicon : `/${favicon}`;
16+
const ogImageUrl = `${SITE_URL}${ogImagePath}`;
17+
18+
let canonicalUrl = $state(SITE_URL);
19+
20+
$effect(() => {
21+
canonicalUrl = `${SITE_URL}${page.url.pathname}${page.url.search}`;
22+
});
23+
1124
type AuthData = App.PageData['auth'];
1225
const DEFAULT_AUTH: AuthData = {
1326
isAuthenticated: false,
@@ -38,8 +51,20 @@
3851

3952
<svelte:head>
4053
<link rel="icon" href={favicon} />
41-
<title>{page.url.pathname === '/' ? '' : page.url.pathname.slice(1) + ' - '} rustytime</title>
42-
<meta name="description" content="Blazingly fast time tracking for developers." />
54+
<link rel="canonical" href={canonicalUrl} />
55+
<title>{SITE_TITLE}</title>
56+
<meta name="description" content={SITE_DESCRIPTION} />
57+
<meta property="og:type" content="website" />
58+
<meta property="og:site_name" content={SITE_TITLE} />
59+
<meta property="og:title" content={SITE_TITLE} />
60+
<meta property="og:description" content={SITE_DESCRIPTION} />
61+
<meta property="og:url" content={canonicalUrl} />
62+
<meta property="og:image" content={ogImageUrl} />
63+
<meta property="og:image:alt" content="rustytime logo" />
64+
<meta name="twitter:card" content="summary_large_image" />
65+
<meta name="twitter:title" content={SITE_TITLE} />
66+
<meta name="twitter:description" content={SITE_DESCRIPTION} />
67+
<meta name="twitter:image" content={ogImageUrl} />
4368
</svelte:head>
4469

4570
<div class="app-container flex h-screen bg-mantle">

frontend/src/routes/admin/+page.svelte

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@
7979
}
8080
</script>
8181

82+
<svelte:head>
83+
<title>Admin - rustytime</title
84+
</svelte:head>
85+
8286
{#if adminData}
8387
<div class="bg-ctp-mantle">
8488
<div class="max-w-6xl mx-auto py-4 md:py-12 px-3">

frontend/src/routes/dashboard/+page.svelte

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,10 @@ api_key = ${dashboardData.api_key}`;
157157
});
158158
</script>
159159

160+
<svelte:head>
161+
<title>Dashboard - rustytime</title
162+
</svelte:head>
163+
160164
{#if dashboardData}
161165
<div class="bg-ctp-mantle">
162166
<div class="max-w-6xl mx-auto py-4 md:py-12 px-3">

0 commit comments

Comments
 (0)