aboutsummaryrefslogtreecommitdiff
path: root/examples/blog/src/components/BaseHead.astro
diff options
context:
space:
mode:
authorGravatar Fred K. Schott <fkschott@gmail.com> 2022-07-21 10:45:59 -0700
committerGravatar GitHub <noreply@github.com> 2022-07-21 13:45:59 -0400
commitddefb172f66bcd646dd0b75a7ea8360157dd2ba0 (patch)
treea43eb2a6a7cadf867e3f333e09ebac51974b1438 /examples/blog/src/components/BaseHead.astro
parentd503c5bf3db39afeecb28522861ac5d78c919408 (diff)
downloadastro-ddefb172f66bcd646dd0b75a7ea8360157dd2ba0.tar.gz
astro-ddefb172f66bcd646dd0b75a7ea8360157dd2ba0.tar.zst
astro-ddefb172f66bcd646dd0b75a7ea8360157dd2ba0.zip
Replace/Rename Astro.canonicalURL with new Astro.url helper (#3959)
* add Astro.url * Add examples of how to create the canonicalURL Co-authored-by: Matthew Phillips <matthew@skypack.dev>
Diffstat (limited to 'examples/blog/src/components/BaseHead.astro')
-rw-r--r--examples/blog/src/components/BaseHead.astro5
1 files changed, 3 insertions, 2 deletions
diff --git a/examples/blog/src/components/BaseHead.astro b/examples/blog/src/components/BaseHead.astro
index f7395b4e3..cc6f89ff1 100644
--- a/examples/blog/src/components/BaseHead.astro
+++ b/examples/blog/src/components/BaseHead.astro
@@ -6,6 +6,7 @@ export interface Props {
description: string;
}
+const canonicalURL = new URL(Astro.url.pathname, Astro.site);
const { title, description } = Astro.props;
---
@@ -21,14 +22,14 @@ const { title, description } = Astro.props;
<!-- Open Graph / Facebook -->
<meta property="og:type" content="website" />
-<meta property="og:url" content={Astro.canonicalURL} />
+<meta property="og:url" content={canonicalURL} />
<meta property="og:title" content={title} />
<meta property="og:description" content={description} />
<meta property="og:image" content="https://astro.build/social.png" />
<!-- Twitter -->
<meta property="twitter:card" content="summary_large_image" />
-<meta property="twitter:url" content={Astro.canonicalURL} />
+<meta property="twitter:url" content={canonicalURL} />
<meta property="twitter:title" content={title} />
<meta property="twitter:description" content={description} />
<meta property="twitter:image" content="https://astro.build/social.png" />