From 26c08c9af66ced9c9e49008d35d7065d6ea80bf5 Mon Sep 17 00:00:00 2001 From: Luca Bosin Date: Fri, 25 Aug 2023 21:55:57 +0200 Subject: [PATCH] Improve SEO --- src/lib/data/language.ts | 2 ++ src/routes/+layout.svelte | 36 +++++++++++++++++++++++++++++++++--- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/src/lib/data/language.ts b/src/lib/data/language.ts index c66f17c..16f9493 100644 --- a/src/lib/data/language.ts +++ b/src/lib/data/language.ts @@ -10,6 +10,7 @@ const translations: Record> = { 'albums': 'Alben', 'photo': 'Foto', 'photos': 'Fotos', + 'photo-description': 'Foto von Luca Bosin', 'video': 'Video', 'videos': 'Videos', 'back': 'Zurück', @@ -31,6 +32,7 @@ const translations: Record> = { 'albums': 'Albums', 'photo': 'Photo', 'photos': 'Photos', + 'photo-description': 'Photo by Luca Bosin', 'video': 'Video', 'videos': 'Videos', 'back': 'Back', diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 9e86adf..e6337ec 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -2,13 +2,43 @@ import { page } from '$app/stores'; import '@fontsource/poppins'; import '$lib/styles/base.css'; + import { str, strf } from '$lib/data/language'; - $: console.log($page.data); + $: metaTitle = ($page.data.title ? + $strf($page.data.title): + null + ) || + ($page.data.album && $page.data.album.title ? + $strf($page.data.album.title): + null + ) || + ($page.data.item ? + $page.data.item.title ? + $strf($page.data.item.title): + $page.data.item.item: + null + ) || + $str('gallery'); + $: metaDescription = ($page.data.description ? + $strf($page.data.description): + null + ) || + ($page.data.album && $page.data.album.description ? + $strf($page.data.album.description): + null + ) || + ($page.data.item ? + $page.data.item.description ? + $strf($page.data.item.description): + $str('photo-description'): + null + ) || + $str('gallery-description'); - {$page.data.title || 'Galerie'} | bosin.ch - + {metaTitle} | bosin.ch +