diff options
author | 2021-05-11 17:31:52 -0600 | |
---|---|---|
committer | 2021-05-11 17:31:52 -0600 | |
commit | 7184149514260c9c5f8525648af1c0f2e51c998e (patch) | |
tree | 251fad305a2e22ea91adecd1e1f751b67c2bab09 /examples/blog/src | |
parent | d2eb413a6e4d423880bb3af93b63e3f37a6f1049 (diff) | |
download | astro-7184149514260c9c5f8525648af1c0f2e51c998e.tar.gz astro-7184149514260c9c5f8525648af1c0f2e51c998e.tar.zst astro-7184149514260c9c5f8525648af1c0f2e51c998e.zip |
Add Astro.request.canonicalURL and Astro.site to global (#199)
Diffstat (limited to 'examples/blog/src')
-rw-r--r-- | examples/blog/src/components/MainHead.astro | 7 | ||||
-rw-r--r-- | examples/blog/src/pages/index.astro | 6 |
2 files changed, 12 insertions, 1 deletions
diff --git a/examples/blog/src/components/MainHead.astro b/examples/blog/src/components/MainHead.astro index bff812b0c..dfeb9dfb4 100644 --- a/examples/blog/src/components/MainHead.astro +++ b/examples/blog/src/components/MainHead.astro @@ -4,6 +4,9 @@ export let title: string; export let description: string; export let image: string | undefined; export let type: string | undefined; +export let next: string | undefined; +export let prev: string | undefined; +export let canonicalURL: string | undefined; // internal data const OG_TYPES = { @@ -17,6 +20,10 @@ const OG_TYPES = { <title>{title}</title> <meta name="description" content={description} /> <link rel="stylesheet" href="/global.css" /> +<link rel="sitemap" href="/sitemap.xml" /> +<link rel="canonical" href={canonicalURL} /> +{next && <link rel="next" href={next} />} +{prev && <link rel="prev" href={prev} />} <!-- OpenGraph --> <meta property="og:title" content={title} /> diff --git a/examples/blog/src/pages/index.astro b/examples/blog/src/pages/index.astro index 2af3a1a03..19ea4ebf9 100644 --- a/examples/blog/src/pages/index.astro +++ b/examples/blog/src/pages/index.astro @@ -21,7 +21,11 @@ let firstThree = allPosts.slice(0, 3); <html> <head> <title>{title}</title> - <MainHead title={title} description={description} /> + <MainHead + title={title} + description={description} + canonicalURL={Astro.request.canonicalURL.href} + /> </head> <body> |