feat: support custom canonical URLs (#83)

Adding an optional attribute in the posts' frontmatter that allows the user to set a custom canonical URL
This commit is contained in:
Nahuel Garbezza
2023-07-21 21:28:24 -03:00
committed by Sat Naing
parent 08383093d1
commit 4687bd516b
4 changed files with 7 additions and 6 deletions
+2 -2
View File
@@ -9,6 +9,7 @@ export interface Props {
author?: string;
description?: string;
ogImage?: string;
canonicalURL?: string;
}
const {
@@ -16,10 +17,9 @@ const {
author = SITE.author,
description = SITE.desc,
ogImage = SITE.ogImage,
canonicalURL = new URL(Astro.url.pathname, Astro.site).href,
} = Astro.props;
const canonicalURL = new URL(Astro.url.pathname, Astro.site);
const socialImageURL = new URL(
ogImage ? ogImage : SITE.ogImage,
Astro.url.origin