Skip to content

Commit

Permalink
fix: Fixup meta tags
Browse files Browse the repository at this point in the history
  • Loading branch information
kiosion committed Oct 3, 2023
1 parent 783ba4d commit 107328c
Show file tree
Hide file tree
Showing 22 changed files with 35 additions and 51 deletions.
1 change: 0 additions & 1 deletion svelte-app/src/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,400;0,500;0,700;1,400;1,500;1,700&family=Ubuntu+Mono:ital,wght@0,400;0,700;1,400;1,700&family=Work+Sans:ital,wght@0,100;0,200;0,300;0,400;1,100;1,200;1,300;1,400&display=swap"
rel="stylesheet"
/>
<script src="https://unpkg.com/twemoji@latest/dist/twemoji.min.js" crossorigin="anonymous" defer></script>
%sveltekit.head%
</head>
<body>
Expand Down
38 changes: 13 additions & 25 deletions svelte-app/src/components/document/route.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,8 @@
scrollTo($page?.url);
});
$: allTags =
(data?.tags || [])
.reduce(
(acc, tag) => (tag.title && acc.push(tag.title.toLowerCase()), acc),
[] as string[]
)
?.join(', ') + ', ' || '';
$: $page?.url && scrollTo($page.url);
$: pageTitle = `${BASE_PAGE_TITLE}${data?.title ? ` | ${data.title}` : ''}`;
$: pageTitle = `${BASE_PAGE_TITLE} ~ ${data.title}`;
$: pageDescription = data?.desc
? data.desc.length > 160
? `${data.desc.slice(0, 160 - 3)}...`
Expand All @@ -43,30 +36,25 @@

<svelte:head>
<title>{pageTitle}</title>

<meta itemprop="name" content={pageTitle} />
<meta itemprop="description" content={pageDescription} />

<meta name="robots" content="index, nofollow" />
<meta name="description" content={pageDescription} />
<meta property="og:type" content="article" />
<meta property="og:title" content={pageTitle} />
<meta property="og:description" content={pageDescription} />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content={data.title} />
<meta name="twitter:description" content={pageDescription} />
<meta property="article:author" content="Kio" />
<meta
name="keywords"
content="{allTags}blog, {model === 'post'
? 'blog post'
: 'project'}, kio.dev, kio, kiosion"
property="article:published_time"
content={new Date(data.date || '0')?.toISOString()}
/>
<meta name="author" content="Kio" />

<meta property="og:type" content="website" />
<meta property="og:url" content={$page.url.href} />
<meta property="og:title" content={pageTitle} />
<meta
property="og:description"
content={data?.desc ? data.desc : $t('A post on kio.dev')}
property="article:modified_time"
content={new Date(data.date || '0')?.toISOString()}
/>

<meta property="twitter:url" content={$page.url.href} />
<meta property="twitter:title" content={pageTitle} />
<meta property="twitter:description" content={pageDescription} />
</svelte:head>

<ContentWrapper>
Expand Down
2 changes: 1 addition & 1 deletion svelte-app/src/lib/helpers/navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@ export const pageTitle = derived([isLocalized, t, page], (vals) => {
route = APP_ROUTES.find((r) => r.path === pathname);

return route?.name?.length
? `${BASE_PAGE_TITLE} | ${vals[1](route.name)}`
? `${BASE_PAGE_TITLE} ~ ${vals[1](route.name)}`
: BASE_PAGE_TITLE;
});
1 change: 1 addition & 0 deletions svelte-app/src/routes/+error.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@

<svelte:head>
<title>kio.dev | {status}</title>
<meta name="robots" content="none" />
</svelte:head>

<div class="mt-12">
Expand Down
14 changes: 13 additions & 1 deletion svelte-app/src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import { isDesktop } from '$helpers/responsive';
import { check as checkTranslations, currentLang, isLocalized, t } from '$i18n';
import { APP_LANGS, BASE_ANIMATION_DURATION, DEFAULT_APP_LANG } from '$lib/consts';
import { ENV } from '$lib/env';
import { ENV, SELF_BASE_URL } from '$lib/env';
import { setState as setMenuState, state as menuState } from '$lib/helpers/menu';
import { navOpen } from '$stores/navigation';
import Settings, { loading } from '$stores/settings';
Expand Down Expand Up @@ -95,6 +95,18 @@
$: browser && (document.documentElement.lang = $currentLang);
</script>

<svelte:head>
<meta name="author" content="Kio" />
<meta name="theme-color" content={$theme === 'dark' ? '#16160e' : '#e5e4e6'} />
<meta property="og:locale" content={$currentLang === 'fr' ? 'fr_CA' : 'en_CA'} />
<meta property="og:site_name" content="kio.dev" />
<meta property="og:url" content={$page?.url?.href} />
<meta property="og:image" content="{SELF_BASE_URL}/assets/dark-embed.png" />
<meta property="twitter:url" content={$page?.url?.href} />
<meta property="twitter:site" content="@0xKI0" />
<meta property="twitter:image" content="{SELF_BASE_URL}/assets/dark-embed.png" />
</svelte:head>

<svelte:body
use:classList={`${$theme} ${$navigating ? 'is-loading' : 'is-loaded'}`}
on:contextmenu|preventDefault={(e) => setMenuState(e, pageContainer)}
Expand Down
8 changes: 2 additions & 6 deletions svelte-app/src/routes/[[lang=lang]]/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<script lang="ts">
import { page } from '$app/stores';
import { pageTitle } from '$helpers/navigation';
import { linkTo, t } from '$i18n';
Expand All @@ -12,21 +11,18 @@
export let data;
$: description = $t('A bit about me, my work, and what I do');
$: description = $t('A bit about me and what I do');
</script>

<svelte:head>
<title>{$pageTitle}</title>
<meta itemprop="name" content={$pageTitle} />
<meta itemprop="description" content={description} />
<meta name="robots" content="index, follow" />
<meta name="description" content={description} />
<meta name="keywords" content="about, index, homepage, home, kio.dev, kio, kiosion" />
<meta name="author" content="Kio" />
<meta property="og:type" content="website" />
<meta property="og:url" content={$page.url.href} />
<meta property="og:title" content={$pageTitle} />
<meta property="og:description" content={description} />
<meta property="twitter:url" content={$page.url.href} />
<meta property="twitter:title" content={$pageTitle} />
<meta property="twitter:description" content={description} />
</svelte:head>
Expand Down
8 changes: 2 additions & 6 deletions svelte-app/src/routes/[[lang=lang]]/blog/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<script lang="ts">
import { page } from '$app/stores';
import { sortDocumentsByYear } from '$helpers/date';
import { t } from '$helpers/i18n';
import { pageTitle } from '$helpers/navigation';
Expand All @@ -19,15 +18,12 @@
<title>{$pageTitle}</title>
<meta itemprop="name" content={$pageTitle} />
<meta itemprop="description" content={description} />
<meta name="robots" content="index, follow" />
<meta name="description" content={description} />
<meta name="keywords" content="blog, posts, blog posts, kio.dev, kio, kiosion" />
<meta name="author" content="Kio" />
<meta property="og:type" content="website" />
<meta property="og:url" content={$page?.url?.href} />
<meta property="og:title" content={$pageTitle} />
<meta property="og:description" content={description} />
<meta property="twitter:url" content={$page?.url?.href} />
<meta property="twitter:title" content="kio.dev | blog" />
<meta property="twitter:title" content={$pageTitle} />
<meta property="twitter:description" content={description} />
</svelte:head>

Expand Down
8 changes: 2 additions & 6 deletions svelte-app/src/routes/[[lang=lang]]/etc/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<script lang="ts">
import { page } from '$app/stores';
import { pageTitle } from '$helpers/navigation';
import { t } from '$i18n';
Expand All @@ -11,21 +10,18 @@
export let data;
$: description = $t('A peek into my current adventures in tech and beyond');
$: description = $t('How to get in touch, and some meta info about this site');
</script>

<svelte:head>
<title>{$pageTitle}</title>
<meta itemprop="name" content={$pageTitle} />
<meta itemprop="description" content={description} />
<meta name="robots" content="index, follow" />
<meta name="description" content={description} />
<meta name="keywords" content="About, kio.dev, kio, kiosion" />
<meta name="author" content="Kio" />
<meta property="og:type" content="website" />
<meta property="og:url" content={$page.url.href} />
<meta property="og:title" content={$pageTitle} />
<meta property="og:description" content={description} />
<meta property="twitter:url" content={$page.url.href} />
<meta property="twitter:title" content={$pageTitle} />
<meta property="twitter:description" content={description} />
</svelte:head>
Expand Down
6 changes: 1 addition & 5 deletions svelte-app/src/routes/[[lang=lang]]/work/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<script lang="ts">
import { page } from '$app/stores';
import { pageTitle } from '$helpers/navigation';
import { t } from '$i18n';
import { sortDocumentsByYear } from '$lib/helpers/date';
Expand All @@ -23,14 +22,11 @@
<title>{$pageTitle}</title>
<meta itemprop="name" content={$pageTitle} />
<meta itemprop="description" content={description} />
<meta name="robots" content="index, follow" />
<meta name="description" content={description} />
<meta name="keywords" content="work, experience, projects, kio.dev, kio, kiosion" />
<meta name="author" content="Kio" />
<meta property="og:type" content="website" />
<meta property="og:url" content={$page?.url?.href} />
<meta property="og:title" content={$pageTitle} />
<meta property="og:description" content={description} />
<meta property="twitter:url" content={$page?.url?.href} />
<meta property="twitter:title" content={$pageTitle} />
<meta property="twitter:description" content={description} />
</svelte:head>
Expand Down
Binary file modified svelte-app/static/android-chrome-192x192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified svelte-app/static/android-chrome-512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified svelte-app/static/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added svelte-app/static/assets/dark-embed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added svelte-app/static/assets/dark-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added svelte-app/static/assets/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added svelte-app/static/assets/light-embed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added svelte-app/static/assets/light-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed svelte-app/static/assets/spinner.png
Binary file not shown.
Binary file removed svelte-app/static/assets/spinner.webp
Binary file not shown.
Binary file modified svelte-app/static/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified svelte-app/static/favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified svelte-app/static/favicon.ico
Binary file not shown.

0 comments on commit 107328c

Please sign in to comment.