Skip to content

Commit ff28e51

Browse files
committed
feat(*): add SEO tags
1 parent b889d8c commit ff28e51

8 files changed

Lines changed: 53 additions & 7 deletions

File tree

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
},
2222
"devDependencies": {
2323
"@types/node": "^20.2.5",
24+
"astro-seo": "^0.7.2",
2425
"prettier": "^2.8.8",
2526
"prettier-plugin-astro": "^0.10.0",
2627
"rehype-autolink-headings": "^6.1.1",

pnpm-lock.yaml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/og.png

168 KB
Loading

public/twitter.png

179 KB
Loading

src/layouts/Docs.astro

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,15 @@ import Layout from "./Layout.astro";
33
44
import Navigation from "../components/Navigation.astro";
55
import Sidebar from "../components/Sidebar.astro";
6+
7+
export interface Props {
8+
title: string;
9+
}
10+
11+
const { title } = Astro.props;
612
---
713

8-
<Layout title="Docs | The Open Dictionary">
14+
<Layout title={`${title} | The Open Dictionary`}>
915
<div class="flex flex-col h-full">
1016
<Navigation />
1117
<div class="flex flex-row flex-grow">

src/layouts/Layout.astro

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
---
2+
import { SEO } from "astro-seo";
3+
24
export interface Props {
35
title: string;
46
}
@@ -10,16 +12,46 @@ import "@fontsource/montserrat/600.css";
1012
import "@fontsource/montserrat/500.css";
1113
import "@fontsource/noto-sans";
1214
import "@fontsource/noto-sans/600.css";
15+
16+
const description =
17+
"A modern, blazingly-fast dictionary file format for everyone 🚀";
1318
---
1419

1520
<html class="w-full h-full" lang="en">
1621
<head>
1722
<meta charset="UTF-8" />
1823
<meta name="description" content="Astro description" />
1924
<meta name="viewport" content="width=device-width" />
20-
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
2125
<meta name="generator" content={Astro.generator} />
22-
<title>{title}</title>
26+
<SEO
27+
title={title}
28+
description={description}
29+
openGraph={{
30+
basic: {
31+
title,
32+
type: "site",
33+
image: `${Astro.url.origin}/og.png`,
34+
},
35+
optional: {
36+
description,
37+
},
38+
}}
39+
twitter={{
40+
title,
41+
description,
42+
card: "summary_large_image",
43+
image: `${Astro.url.origin}/twitter.png`,
44+
}}
45+
extend={{
46+
link: [
47+
{
48+
rel: "icon",
49+
type: "image/svg+xml",
50+
href: "/favicon.ico",
51+
},
52+
],
53+
}}
54+
/>
2355
</head>
2456
<body class="w-full h-full">
2557
<slot />

src/pages/docs/[...slug].astro

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,8 @@ const { prevDoc, nextDoc, doc } = Astro.props;
3535
const { Content } = await doc.render();
3636
---
3737

38-
<Docs>
38+
<Docs title={doc.data.title}>
3939
<Content />
40-
4140
<footer class="ftr">
4241
{
4342
prevDoc ? (

src/pages/index.astro

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@ import Layout from "../layouts/Layout.astro";
1919
The Open Dictionary
2020
</h1>
2121
<p class="text-slate-500 text-lg mb-8">
22-
A blazingly-fast, portable dictionary file format for everyone 🚀
22+
A modern, blazingly-fast dictionary file format for everyone 🚀
2323
</p>
24-
<div class="flex gap-6 lg:gap-12 flex-col-reverse lg:flex-row justify-center items-center">
24+
<div
25+
class="flex gap-6 lg:gap-12 flex-col-reverse lg:flex-row justify-center items-center"
26+
>
2527
<a
2628
href="https://github.com/TheOpenDictionary/odict"
2729
target="_blank"

0 commit comments

Comments
 (0)