From 45c21acc4aaff1afeb382f21254258ae576d36c0 Mon Sep 17 00:00:00 2001 From: Michael Uloth Date: Mon, 23 Dec 2024 11:34:56 -0500 Subject: [PATCH] bookmarks: set canonical link to original source --- src/layouts/Base.astro | 7 ++++--- src/layouts/Main.astro | 4 ++-- src/layouts/Writing.astro | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/layouts/Base.astro b/src/layouts/Base.astro index ac520676..26c8de59 100644 --- a/src/layouts/Base.astro +++ b/src/layouts/Base.astro @@ -8,6 +8,7 @@ import { getTILs } from '../utils/tils' import { getBookmarks } from '../utils/bookmarks' export type BaseProps = { + canonicalUrl?: string description?: string ogImage?: string title?: string @@ -15,8 +16,8 @@ export type BaseProps = { type Props = BaseProps -const { description, ogImage, title } = Astro.props -const { pathname } = Astro.url +const { canonicalUrl, description, ogImage, title } = Astro.props +const { href, pathname } = Astro.url const posts = await getPosts() const tils = await getTILs() @@ -144,7 +145,7 @@ const socialImage = ogImage {pageTitleWithSuffix} - + diff --git a/src/layouts/Main.astro b/src/layouts/Main.astro index a990f7af..94db514e 100644 --- a/src/layouts/Main.astro +++ b/src/layouts/Main.astro @@ -5,10 +5,10 @@ import Base, { type BaseProps } from './Base.astro' type Props = BaseProps -const { description, title, ogImage } = Astro.props +const { description, title, ogImage, canonicalUrl } = Astro.props --- - +
diff --git a/src/layouts/Writing.astro b/src/layouts/Writing.astro index 85fa3e68..12c07972 100644 --- a/src/layouts/Writing.astro +++ b/src/layouts/Writing.astro @@ -29,7 +29,7 @@ const isDraft = isPathnameInCollection(pathname, drafts) // const tags = cleanTags(entry.data.tags) --- -
+
{