SEO optimizations

SEO optimizations using astro-seo and SEO component
Modified i18n to incorporate complex SEO
This commit is contained in:
Cyril Šebek 2024-07-09 15:59:09 +02:00
parent 9a84d9acbb
commit 85d38eb3d5
Signed by: blboun3
SSH Key Fingerprint: SHA256:n9dMtOPzgsD+CCerUJslEnU2dzVanbaIv0XDQVRVjeg
14 changed files with 628 additions and 35 deletions

View File

@ -25,9 +25,11 @@
"@radix-ui/react-slot": "^1.0.2", "@radix-ui/react-slot": "^1.0.2",
"@radix-ui/react-tabs": "^1.0.4", "@radix-ui/react-tabs": "^1.0.4",
"@radix-ui/react-tooltip": "^1.1.2", "@radix-ui/react-tooltip": "^1.1.2",
"@tailwindcss/typography": "^0.5.13",
"@types/react": "^18.2.74", "@types/react": "^18.2.74",
"@types/react-dom": "^18.2.24", "@types/react-dom": "^18.2.24",
"astro": "^4.11.5", "astro": "^4.11.5",
"astro-seo": "^0.8.4",
"class-variance-authority": "^0.7.0", "class-variance-authority": "^0.7.0",
"clsx": "^2.1.0", "clsx": "^2.1.0",
"cmdk": "^1.0.0", "cmdk": "^1.0.0",
@ -41,7 +43,6 @@
"tailwindcss": "^3.4.1", "tailwindcss": "^3.4.1",
"tailwindcss-animate": "^1.0.7", "tailwindcss-animate": "^1.0.7",
"vaul": "^0.9.0", "vaul": "^0.9.0",
"zod": "^3.23.8", "zod": "^3.23.8"
"@tailwindcss/typography": "^0.5.13"
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
export const cs = { export const cs = {
title: "Cyril Šebek", // Title of the main page in browser's handlebard title: "Cyril Šebek", // Title of the main page in browser's handlebard
description: "Personal website of one weird student", // HTML page description escription: "Hi there, I am Cyril, one weird student from Czechia, also a programmer and a musician.",
favicon: "/favicon.svg", favicon: "/favicon.svg",
/* /*
@ -106,6 +106,7 @@ export const cs = {
pageTitle: "Moje skladby @ Cyril Šebek", pageTitle: "Moje skladby @ Cyril Šebek",
title: "Moje skladby", title: "Moje skladby",
description: "Seznam mých skladeb.", description: "Seznam mých skladeb.",
ogDescription: "This page lists all published compositions by Cyril Šebek",
downloadPDF: "Stáhnout PDF", downloadPDF: "Stáhnout PDF",
downloadMP3: "Stáhnout MP3", downloadMP3: "Stáhnout MP3",
downloadFLAC: "Stáhnout FLAC" downloadFLAC: "Stáhnout FLAC"

View File

@ -1,6 +1,6 @@
export const de = { export const de = {
title: "Cyril Šebek", // Title of the main page in browser's handlebard title: "Cyril Šebek", // Title of the main page in browser's handlebard
description: "Personal website of one weird student", // HTML page description description: "Hi there, I am Cyril, one weird student from Czechia, also a programmer and a musician.",
favicon: "/favicon.svg", favicon: "/favicon.svg",
/* /*
@ -106,6 +106,7 @@ export const de = {
pageTitle: "Music @ Cyril Šebek", pageTitle: "Music @ Cyril Šebek",
title: "My compositions", title: "My compositions",
description: "This is page is listing all my published musical compositions.", description: "This is page is listing all my published musical compositions.",
ogDescription: "This page lists all published compositions by Cyril Šebek",
downloadPDF: "Download PDF", downloadPDF: "Download PDF",
downloadMP3: "Download MP3", downloadMP3: "Download MP3",
downloadFLAC: "Download FLAC" downloadFLAC: "Download FLAC"

View File

@ -1,6 +1,6 @@
export const en = { export const en = {
title: "Cyril Šebek", // Title of the main page in browser's handlebard title: "Cyril Šebek", // Title of the main page in browser's handlebard
description: "Personal website of one weird student", // HTML page description description: "Hi there, I am Cyril, one weird student from Czechia, also a programmer and a musician.",
favicon: "/favicon.svg", favicon: "/favicon.svg",
/* /*
@ -106,6 +106,7 @@ export const en = {
pageTitle: "Music @ Cyril Šebek", pageTitle: "Music @ Cyril Šebek",
title: "My compositions", title: "My compositions",
description: "This is page is listing all my published musical compositions.", description: "This is page is listing all my published musical compositions.",
ogDescription: "This page lists all published compositions by Cyril Šebek",
downloadPDF: "Download PDF", downloadPDF: "Download PDF",
downloadMP3: "Download MP3", downloadMP3: "Download MP3",
downloadFLAC: "Download FLAC" downloadFLAC: "Download FLAC"

View File

@ -1,6 +1,6 @@
export const fr = { export const fr = {
title: "Cyril Šebek", // Title of the main page in browser's handlebard title: "Cyril Šebek", // Title of the main page in browser's handlebard
description: "Personal website of one weird student", // HTML page description description: "Hi there, I am Cyril, one weird student from Czechia, also a programmer and a musician.",
favicon: "/favicon.svg", favicon: "/favicon.svg",
/* /*
@ -106,6 +106,7 @@ export const fr = {
pageTitle: "Music @ Cyril Šebek", pageTitle: "Music @ Cyril Šebek",
title: "My compositions", title: "My compositions",
description: "This is page is listing all my published musical compositions.", description: "This is page is listing all my published musical compositions.",
ogDescription: "This page lists all published compositions by Cyril Šebek",
downloadPDF: "Download PDF", downloadPDF: "Download PDF",
downloadMP3: "Download MP3", downloadMP3: "Download MP3",
downloadFLAC: "Download FLAC" downloadFLAC: "Download FLAC"

View File

@ -1,17 +1,15 @@
--- ---
import type { CollectionEntry } from "astro:content";
import SinglePageBlogMode from "./SinglePageBlogMode.astro"; import SinglePageBlogMode from "./SinglePageBlogMode.astro";
import MainLayout from "./MainLayout.astro"; import MainLayout from "./MainLayout.astro";
type Props = CollectionEntry<"blog">["data"]; const { title, description, language, openGraph } = Astro.props;
const { title, description, language } = Astro.props;
--- ---
<MainLayout <MainLayout
title=`${title} @ Cyril Šebek` title=`${title} @ Cyril Šebek`
description={description} description={description}
lang={language} lang={language}
openGraph={openGraph}
> >
<SinglePageBlogMode> <SinglePageBlogMode>
<slot /> <slot />

View File

@ -1,9 +1,10 @@
--- ---
const { title, description, lang, themeOverride } = Astro.props; const { title, description, lang, themeOverride, openGraph } = Astro.props;
import { ViewTransitions } from 'astro:transitions'; import { ViewTransitions } from 'astro:transitions';
import Navbar from "../components/Navbar.astro"; import Navbar from "../components/Navbar.astro";
import "../style/index.css"; import "../style/index.css";
import { useTranslations } from '../i18n/utils'; import { useTranslations } from '../i18n/utils';
import { SEO } from "astro-seo";
const t = useTranslations(lang) const t = useTranslations(lang)
--- ---
@ -20,6 +21,11 @@ const t = useTranslations(lang)
<link rel="shortcut icon" href={t("favicon")}> <link rel="shortcut icon" href={t("favicon")}>
<link rel="shortcut icon" href={t("favicon")} type="image/x-icon"> <link rel="shortcut icon" href={t("favicon")} type="image/x-icon">
<title>{title}</title> <title>{title}</title>
<SEO
title={title}
description={description}
openGraph={openGraph}
/>
<ViewTransitions /> <ViewTransitions />
</head> </head>
<body class="bg-bkg" > <body class="bg-bkg" >

View File

@ -25,9 +25,22 @@ const page = Astro.props;
const formattedDate = page.data.publishDate?.toLocaleString(lang); const formattedDate = page.data.publishDate?.toLocaleString(lang);
const { Content } = await page.render(); const { Content } = await page.render();
const og = {
basic: {
title: page.data.title,
type: "article",
image: page.data.image.url
},
article: {
publishedTime: page.data.publishDate,
authors: [page.data.author],
tags: page.data.tags
}
}
--- ---
<BlogPost {...page.data} language={lang}> <BlogPost {...page.data} language={lang} openGraph={og}>
<article <article
class="prose prose-moi m-[auto] sm:prose-sm md:prose-md lg:prose-lg text-justify" class="prose prose-moi m-[auto] sm:prose-sm md:prose-md lg:prose-lg text-justify"
> >

View File

@ -19,12 +19,26 @@ var posts = await getBlogPosts();
var filtered_posts = posts.filter( var filtered_posts = posts.filter(
(post) => post.data.language == Astro.currentLocale, (post) => post.data.language == Astro.currentLocale,
); );
const og = {
basic: {
title: t("blog")["title"],
type: "website",
image: t("favicon")
},
optional: {
description: t("blog")["ogDescription"],
locale: getLangFromUrl(Astro.url),
siteName: "Cyril Šebek"
}
};
--- ---
<MainLayout <MainLayout
title={t("blog")["title"]} title={t("blog")["title"]}
description={t("blog")["description"]} description={t("blog")["ogDescription"]}
lang={Astro.currentLocale} lang={Astro.currentLocale}
openGraph={og}
> >
<SinglePageBlogMode> <SinglePageBlogMode>
<div class="p-4"> <div class="p-4">

View File

@ -33,9 +33,22 @@ const { lang, tag } = Astro.params;
const { posts } = Astro.props; const { posts } = Astro.props;
const filteredPosts = posts.filter((post) => post.data.tags?.includes(tag) && post.data.language == Astro.currentLocale); const filteredPosts = posts.filter((post) => post.data.tags?.includes(tag) && post.data.language == Astro.currentLocale);
const og = {
basic: {
title: `${t("postsTagged")} "${tag}"}`,
image: t("favicon"),
type: "website"
},
optional: {
description: t("blog")["ogDescription"],
locale: getLangFromUrl(Astro.url),
siteName: "Cyril Šebek"
}
}
--- ---
<MainLayout title=`${tag} @ Cyril Šebek` description={"desc"} lang={lang}> <MainLayout title=`${tag} @ Cyril Šebek` description={"desc"} lang={lang} openGraph={og}>
<SinglePageBlogMode> <SinglePageBlogMode>
<h1 class="text-2xl text-center font-bold text-content mb-10 mt-5">{t("postsTagged")} "{tag}"</h1> <h1 class="text-2xl text-center font-bold text-content mb-10 mt-5">{t("postsTagged")} "{tag}"</h1>
<PostsList filteredPosts={filteredPosts} lang={Astro.currentLocale} /> <PostsList filteredPosts={filteredPosts} lang={Astro.currentLocale} />

View File

@ -17,8 +17,22 @@ export async function getStaticPaths() {
return { params: { lang } }; return { params: { lang } };
}); });
} }
const og = {
basic: {
title: t("title"),
type: "website",
image: t("favicon")
},
optional: {
description: t("description"),
locale: getLangFromUrl(Astro.url),
siteName: "Cyril Šebek"
}
}
--- ---
<MainLayout title={t("title")} description={t("description")} lang={Astro.currentLocale} themeOverride="theme_auto"> <MainLayout title={t("title")} description={t("description")} openGraph={og} lang={Astro.currentLocale} themeOverride="theme_auto">
<FloatingLinks /> <FloatingLinks />
<Hero /> <Hero />
<About /> <About />

View File

@ -17,12 +17,26 @@ export async function getStaticPaths() {
var songs = await getCompositions() var songs = await getCompositions()
songs = songs.reverse() songs = songs.reverse()
const og = {
basic: {
title: t("music")["title"],
type: "website",
image: t("favicon")
},
optional: {
description: t("music")["ogDescription"],
locale: getLangFromUrl(Astro.url),
siteName: "Cyril Šebek"
}
};
--- ---
<MainLayout <MainLayout
title={t("music")["pageTitle"]} title={t("music")["pageTitle"]}
description={t("music")["description"]} description={t("music")["ogDescription"]}
lang={Astro.currentLocale} lang={Astro.currentLocale}
openGraph={og}
> >
<SinglePageBlogMode> <SinglePageBlogMode>
<div class="p-4"> <div class="p-4">

View File

@ -8,7 +8,7 @@ import Showcase from "../components/Showcase.astro";
import FloatingLinks from "../components/FloatingLinks.astro"; import FloatingLinks from "../components/FloatingLinks.astro";
//@ts-ignore //@ts-ignore
import { getLangFromUrl, useTranslations } from "../i18n/utils"; import { getLangFromUrl, useTranslations } from "../../i18n/utils";
const t = useTranslations(getLangFromUrl(Astro.url)); const t = useTranslations(getLangFromUrl(Astro.url));
@ -17,8 +17,22 @@ export async function getStaticPaths() {
return { params: { lang } }; return { params: { lang } };
}); });
} }
const og = {
basic: {
title: t("title"),
type: "website",
image: t("favicon")
},
optional: {
description: t("description"),
locale: getLangFromUrl(Astro.url),
siteName: "Cyril Šebek"
}
}
--- ---
<MainLayout title={t("title")} description={t("description")} lang={Astro.currentLocale} themeOverride="theme_auto"> <MainLayout title={t("title")} description={t("description")} openGraph={og} lang={Astro.currentLocale} themeOverride="theme_auto">
<head> <head>
<meta http-equiv="refresh" content="0; url=https://cyrilsebek.cz/en"> <meta http-equiv="refresh" content="0; url=https://cyrilsebek.cz/en">
<script type="text/javascript"> <script type="text/javascript">