Skip to content

Commit

Permalink
more og images
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewDTR committed Oct 9, 2024
1 parent 6129aed commit 5fb2520
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/layouts/BaseLayout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Footer from "../components/Footer.astro";
import Header from "../components/Header.astro";
import "../styles/global.css";
const { imgLink } = Astro.props;
const { imgLink, title, subtitle } = Astro.props;
---

<html lang="en">
Expand All @@ -17,6 +17,10 @@ const { imgLink } = Astro.props;
<title>Andrew Moses</title>

{imgLink && <meta property="og:image" content={imgLink} />}
{title && <meta property="og:title" content={title} />}
{subtitle && <meta property="og:description" content={subtitle} />}
<meta property="theme-color" content="#f0e7d8" />

</head>
<body>
<div class="page-wrapper">
Expand Down
6 changes: 5 additions & 1 deletion src/layouts/Blog.astro
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ const hasTags = frontmatter.tags && frontmatter.tags.length > 0;
const imgLink = `${Astro.site.origin}/og/${frontmatter.slug}.png`;
---

<BaseLayout imgLink={imgLink}>
<BaseLayout
imgLink={imgLink}
title={frontmatter.title}
subtitle={frontmatter.subtitle}
>
<div slot="outside-content" class="top">
<p class="blog-title">{frontmatter.title}</p>
<p class="subtitle">{frontmatter.subtitle}</p>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: "Hello World"
subtitle: "Things I've learned from saying Hello to the world"
author: Andrew
tags: ["one", "two", "three"]
slug: "hello-world"
slug: "about"
---

![Example image](/og/index.png)
Expand Down

0 comments on commit 5fb2520

Please sign in to comment.