diff options
Diffstat (limited to 'examples/blog')
-rw-r--r-- | examples/blog/astro.config.mjs | 1 | ||||
-rw-r--r-- | examples/blog/src/components/BaseHead.astro | 5 |
2 files changed, 4 insertions, 2 deletions
diff --git a/examples/blog/astro.config.mjs b/examples/blog/astro.config.mjs index 08916b1fe..39670fcbd 100644 --- a/examples/blog/astro.config.mjs +++ b/examples/blog/astro.config.mjs @@ -4,4 +4,5 @@ import preact from '@astrojs/preact'; // https://astro.build/config export default defineConfig({ integrations: [preact()], + site: `http://astro.build` }); 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" /> |