Skip to content

Commit

Permalink
Better meta descriptions in layout
Browse files Browse the repository at this point in the history
  • Loading branch information
Daveed committed Dec 10, 2024
1 parent d0f398d commit eac5443
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
12 changes: 8 additions & 4 deletions src/layouts/Layout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ export interface Props {
scrollSmooth?: boolean;
post?: CollectionEntry<"posts">;
meta?: {
title: string;
image: string;
description: string;
title?: string;
image?: string;
description?: string;
url?: string;
};
}
Expand Down Expand Up @@ -122,7 +123,10 @@ const store = stores.find(
/>
<meta
property="og:url"
content={post?.data?.SEO?.metaUrl || store?.SEO?.metaUrl || canonicalURL}
content={meta?.url ||
post?.data?.SEO?.metaUrl ||
store?.SEO?.metaUrl ||
canonicalURL}
/>
<meta
property="og:image"
Expand Down
9 changes: 8 additions & 1 deletion src/pages/[slug].astro
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,14 @@ const store = stores.find(
const { page } = Astro.props;
---

<Layout>
<Layout
meta={{
title: page?.SEO?.metaTitle || page?.Title,
image: page?.SEO?.socialImage?.url,
description: page?.SEO?.metaDescription,
url: `/${page?.slug}`,
}}
>
<Header store={store} activeNav={page?.data?.slug as activeNav} />
<Breadcrumbs />
<main id="main-content">
Expand Down

0 comments on commit eac5443

Please sign in to comment.