Skip to content

Commit 0ec7f40

Browse files
committed
chore: customizable tabs
- added the option to change the meta tags of the layout in all pages: blog and individual posts
1 parent 7505207 commit 0ec7f40

3 files changed

Lines changed: 45 additions & 25 deletions

File tree

apps/web/src/layouts/main.astro

Lines changed: 31 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,27 @@ import MovingDotsBackground from "@/components/motion/MovingBackground";
1010
type Props = {
1111
title: string;
1212
isBackgroundDots?: boolean;
13+
twitterTitle?: string;
14+
twitterImage?: string;
15+
twitterImageAlt?: string;
16+
twitterDescription?: string;
17+
ogTitle?: string;
18+
ogImage?: string;
19+
ogDescription?: string;
20+
ogImageAlt?: string;
1321
};
14-
const { title, isBackgroundDots = true } = Astro.props;
22+
const {
23+
title,
24+
isBackgroundDots = true,
25+
twitterTitle = "Friedrich WT",
26+
twitterImage = "https://friedrichwt.dev/og.png",
27+
twitterImageAlt = "Friedrich Wekenon Tokponto's Portfolio",
28+
twitterDescription = "Friedrich Wekenon Tokponto's Portfolio",
29+
ogTitle = "Friedrich WT",
30+
ogImage = "https://friedrichwt.dev/og.png",
31+
ogDescription = "Friedrich Wekenon Tokponto's Portfolio",
32+
ogImageAlt = "Friedrich Wekenon Tokponto's Portfolio",
33+
} = Astro.props;
1534
---
1635

1736
<script is:inline>
@@ -57,40 +76,29 @@ const { title, isBackgroundDots = true } = Astro.props;
5776
<meta name="description" content="Friedrich Wekenon Tokponto" />
5877
<meta name="author" content="Friedrich Wekenon Tokponto" />
5978
<meta
60-
http-equiv="Content-Security-Policy"
79+
http-equiv="content-Security-Policy"
6180
content="upgrade-insecure-requests"
6281
/>
6382
<link rel="icon" href="/favicon.svg" type="image/x-icon" sizes="48x48" />
6483
<link rel="canonical" href={new URL(Astro.url.pathname, Astro.site).href} />
6584
<link rel="sitemap" href="/sitemap-index.xml" />
6685

6786
<!--Open Graph tags-->
68-
<meta property="og:title" content="Friedrich WT" />
87+
<meta property="og:title" content={ogTitle} />
6988
<meta property="og:type" content="website" />
7089
<meta property="og:url" content="https://friedrichwt.dev" />
71-
<meta
72-
property="og:description"
73-
content="Friedrich Wekenon Tokponto's Portfolio"
74-
/>
75-
<meta property="og:image" content="https://friedrichwt.dev/og.png" />
90+
<meta property="og:description" content={ogDescription} />
91+
<meta property="og:image" content={ogImage} />
7692
<meta property="og:image:width" content="1200" />
7793
<meta property="og:image:height" content="630" />
78-
<meta
79-
property="og:image:alt"
80-
content="Friedrich Wekenon Tokponto's Portfolio"
81-
/>
82-
<meta name="twitter:title" content="Friedrich WT" />
83-
<meta name="twitter:image" content="https://friedrichwt.dev/og.png" />
84-
<meta
85-
name="twitter:image:alt"
86-
content="Friedrich Wekenon Tokponto's Portfolio"
87-
/>
88-
<meta name="twitter:creator" content="@FriedrichC109" />
94+
<meta property="og:image:alt" content={ogImageAlt} />
8995

90-
<meta
91-
name="twitter:description"
92-
content="Friedrich Wekenon Tokponto's Portfolio"
93-
/>
96+
<!-- twitter tags -->
97+
<meta name="twitter:title" content={twitterTitle} />
98+
<meta name="twitter:image" content={twitterImage} />
99+
<meta name="twitter:image:alt" content={twitterImageAlt} />
100+
<meta name="twitter:creator" content="@FriedrichC109" />
101+
<meta name="twitter:description" content={twitterDescription} />
94102
<meta name="twitter:card" content="summary_large_image" />
95103

96104
<title>{title}</title>

apps/web/src/pages/blog/[slug].astro

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,14 @@ const postTags = await trpc.tags.findAllTagsForPublishedPost.query({
2222
});
2323
---
2424

25-
<Layout title={post.title} isBackgroundDots={false}>
25+
<Layout
26+
title={post.title}
27+
ogTitle={post.title}
28+
ogImageAlt={post.title}
29+
twitterTitle={post.title}
30+
twitterImageAlt={post.title}
31+
isBackgroundDots={false}
32+
>
2633
<main
2734
class="flex flex-1 flex-col items-center justify-start py-2"
2835
transition:animate="slide"

apps/web/src/pages/blog/index.astro

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@ import TextFade from "@/components/motion/TextFade";
88
const posts = await trpc.posts.findAllPublished.query();
99
---
1010

11-
<Layout title="Blog | Friedrich WT" isBackgroundDots={false}>
11+
<Layout
12+
title="Blog | Friedrich WT"
13+
ogTitle="Blog | Friedrich WT"
14+
twitterTitle="Blog | Friedrich WT"
15+
isBackgroundDots={false}
16+
>
1217
<main class="flex flex-1 items-start justify-center py-2">
1318
<section
1419
class="flex w-1/2 flex-col items-center justify-center gap-12 pt-8 max-xl:w-2/3 max-sm:w-[90%]"

0 commit comments

Comments
 (0)