Skip to content

Commit e1d578f

Browse files
feat: update og image tags
1 parent 3646528 commit e1d578f

8 files changed

Lines changed: 31 additions & 952 deletions

File tree

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
"@resvg/resvg-js": "^2.6.2",
1616
"@tailwindcss/vite": "^4.1.8",
1717
"astro": "^5.9.1",
18-
"astro-opengraph-images": "^1.13.1",
1918
"astro-seo": "^0.8.4",
2019
"sharp": "^0.34.2",
2120
"tailwindcss": "^4.1.8"

pnpm-lock.yaml

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

src/assets/og.png

801 KB
Loading

src/components/BaseHead.astro

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
---
22
import type { ImageMetadata } from "astro";
3-
// import { SEO } from "astro-seo";
4-
// import { getImagePath } from "astro-opengraph-images";
53
64
import { SITE_TITLE } from "../consts";
75
import FallbackImage from "../assets/blog-placeholder.jpg";
@@ -16,8 +14,7 @@ interface Props {
1614
const canonicalURL = new URL(Astro.url.pathname, Astro.site);
1715
1816
const { title, description, image = FallbackImage } = Astro.props;
19-
const { url, site } = Astro;
20-
// const openGraphImageUrl = getImagePath({ url, site });
17+
const { url, site, generator } = Astro;
2118
---
2219

2320
<!-- Global Metadata -->
@@ -29,9 +26,9 @@ const { url, site } = Astro;
2926
rel="alternate"
3027
type="application/rssxml"
3128
title={SITE_TITLE}
32-
href={new URL("rss.xml", Astro.site)}
29+
href={new URL("rss.xml", site)}
3330
/>
34-
<meta name="generator" content={Astro.generator} />
31+
<meta name="generator" content={generator} />
3532

3633
<!-- Font preloads -->
3734
<link
@@ -58,29 +55,15 @@ const { url, site } = Astro;
5855
<meta name="description" content={description} />
5956

6057
<!-- Open Graph / Facebook -->
61-
<!-- <meta property="og:type" content="website" />
62-
<meta property="og:url" content={Astro.url} />
58+
<meta property="og:type" content="website" />
59+
<meta property="og:url" content={url} />
6360
<meta property="og:title" content={title} />
6461
<meta property="og:description" content={description} />
65-
<meta property="og:image" content={new URL(image.src, Astro.url)} /> -->
62+
<meta property="og:image" content={new URL(image.src, url)} />
6663

6764
<!-- Twitter -->
68-
<!-- <meta property="twitter:card" content="summary_large_image" />
69-
<meta property="twitter:url" content={Astro.url} />
65+
<meta property="twitter:card" content="summary_large_image" />
66+
<meta property="twitter:url" content={url} />
7067
<meta property="twitter:title" content={title} />
7168
<meta property="twitter:description" content={description} />
72-
<meta property="twitter:image" content={new URL(image.src, Astro.url)} /> -->
73-
74-
<!-- <SEO
75-
openGraph={{
76-
basic: {
77-
title: title,
78-
type: "website",
79-
image: openGraphImageUrl,
80-
url: url,
81-
},
82-
optional: {
83-
description: description,
84-
},
85-
}}
86-
/> -->
69+
<meta property="twitter:image" content={new URL(image.src, url)} />

src/components/Header.astro

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,9 @@ import SocialLinks from "./SocialLinks.astro";
6262
padding: 0 1em;
6363
}
6464
}
65+
@media screen and (min-width: 720px) and (max-width: 1000px) {
66+
nav {
67+
padding: 2rem;
68+
}
69+
}
6570
</style>

src/layouts/BlogPost.astro

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ const { title, description, publishedDate, updatedDate, heroImage } =
1414

1515
<html lang="en">
1616
<head>
17-
<BaseHead title={title} description={description} />
17+
<BaseHead title={title} description={description} image={heroImage} />
1818
<style>
1919
main {
20-
width: calc(100% - 2em);
20+
width: calc(100% - 0rem);
2121
max-width: 960px;
2222
margin: 0 auto;
2323
}
@@ -32,9 +32,8 @@ const { title, description, publishedDate, updatedDate, heroImage } =
3232
}
3333
.prose {
3434
width: 720px;
35-
max-width: calc(100% - 2em);
35+
max-width: calc(100% - 0em);
3636
margin: auto;
37-
padding: 1em;
3837
color: rgb(var(--gray-dark));
3938
}
4039
.title {

src/pages/index.astro

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import type { Project } from "../types/project";
1111
import CompressOImage from "../assets/compresso.png";
1212
import UltimateNestjsBoilerplateImage from "../assets/ultimate-nestjs-boilerplate.png";
1313
import ProjectCard from "../components/ProjectCard.astro";
14+
import OGImage from "../assets/og.png";
1415
1516
const recentBlogPosts = (await getCollection("blogs"))
1617
.sort(
@@ -54,7 +55,11 @@ const openSourceProjects: Project[] = [
5455
<!doctype html>
5556
<html lang="en">
5657
<head>
57-
<BaseHead title={SITE_TITLE} description={SITE_DESCRIPTION} />
58+
<BaseHead
59+
title={SITE_TITLE}
60+
description={SITE_DESCRIPTION}
61+
image={OGImage}
62+
/>
5863
</head>
5964
<body>
6065
<Header />

src/styles/global.css

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ main {
4242
width: 960px;
4343
max-width: calc(100% - 0em);
4444
margin: auto;
45-
padding: 3em 1em;
45+
padding: 2rem 0.5rem;
4646
}
4747
h1,
4848
h2,
@@ -125,10 +125,17 @@ hr {
125125
body {
126126
font-size: 18px;
127127
}
128+
}
129+
@media (max-width: 720px) {
128130
main {
129131
padding: 1em;
130132
}
131133
}
134+
@media screen and (min-width: 720px) and (max-width: 1000px) {
135+
main {
136+
padding: 2rem;
137+
}
138+
}
132139

133140
.sr-only {
134141
border: 0;

0 commit comments

Comments
 (0)