Skip to content

Commit 57aa516

Browse files
authored
feat: Added meta tags to improve page's SEO (#12)
1 parent 15b2792 commit 57aa516

File tree

3 files changed

+57
-10
lines changed

3 files changed

+57
-10
lines changed
137 KB
Loading

src/layouts/Layout.astro

Lines changed: 51 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,77 @@
22
import Footer from "../components/Footer.astro";
33
import "../styles/global.css";
44
5+
const DEFAULT_KEYWORDS = ["binarybrains", "upiicsa", "algoritigmia"];
6+
7+
const ogImage = {
8+
path: "https://binarybrains-upiicsa.github.io/images/binary-brains-banner.png",
9+
alt: "A logo of a blue brain digitalized",
10+
};
11+
512
interface Props {
613
title: string;
14+
description?: string;
15+
keywords?: string[];
16+
canonical?: URL;
717
}
818
9-
const { title } = Astro.props;
19+
const {
20+
title,
21+
description,
22+
keywords = DEFAULT_KEYWORDS,
23+
canonical,
24+
} = Astro.props;
1025
---
1126

12-
<html lang="en">
27+
<html lang="es">
1328
<head>
1429
<meta charset="utf-8" />
1530
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
1631
<meta name="viewport" content="width=device-width" />
1732
<meta name="generator" content={Astro.generator} />
1833
<base href="https://binarybrains-upiicsa.github.io/" />
34+
35+
<meta name="twitter:card" content="summary_large_image" />
36+
1937
<title>{title}</title>
38+
<meta name="twitter:title" content={title} />
39+
<meta property="og:title" content={title} />
40+
41+
{canonical && <link rel="canonical" href={canonical.toString()} />}
42+
43+
{
44+
description && (
45+
<>
46+
<meta property="og:description" content={description} />
47+
<meta name="twitter:description" content={description} />
48+
<meta name="description" content={description} />
49+
</>
50+
)
51+
}
52+
53+
<meta name="twitter:image" content={ogImage.path} />
54+
<meta name="twitter:image:alt" content={ogImage.alt} />
55+
<meta property="og:image" content={ogImage.path} />
56+
<meta property="og:image:alt" content={ogImage.alt} />
57+
58+
<meta property="og:type" content="website" />
59+
<meta property="og:site_name" content="binarybrains-upiicsa" />
60+
<meta property="og:locale" content="es_MX" />
61+
62+
<meta name="keywords" content={keywords.join(", ")} />
2063
</head>
2164
<body>
22-
<div id="cursor" class="custom-cursor" />
65+
<div id="cursor" class="custom-cursor"></div>
2366
<slot />
2467
<Footer />
2568
</body>
2669
</html>
2770

2871
<script>
2972
const cursor = document.getElementById("cursor");
30-
globalThis.addEventListener("mousemove", (event: MouseEvent) => {
31-
if (cursor) {
32-
cursor.style.transform =
33-
`translate(${event.clientX}px, ${event.clientY}px)`;
34-
}
35-
});
73+
globalThis.addEventListener("mousemove", (event: MouseEvent) => {
74+
if (cursor) {
75+
cursor.style.transform = `translate(${event.clientX}px, ${event.clientY}px)`;
76+
}
77+
});
3678
</script>

src/pages/index.astro

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,12 @@ const events = (await getCollection("events"))
2323
eventDates: event.data.eventDates.find(
2424
(date) => new Date(date.date) >= CURRENT_DATE,
2525
)!,
26-
}));
26+
}))
27+
.sort(
28+
(a, b) =>
29+
new Date(a.eventDates.date).getTime() -
30+
new Date(b.eventDates.date).getTime(),
31+
);
2732
---
2833

2934
<Layout title="Binary Brains">

0 commit comments

Comments
 (0)