change canonical to canonicalUrl for keeping it consistent

This commit is contained in:
Onur Geneş 2022-01-18 20:13:24 +03:00
parent 45d6228868
commit 1835cca296
5 changed files with 7 additions and 8 deletions

View File

@ -166,7 +166,7 @@ summary (optional)
images (optional, if none provided defaults to socialBanner in siteMetadata config) images (optional, if none provided defaults to socialBanner in siteMetadata config)
authors (optional list which should correspond to the file names in `data/authors`. Uses `default` if none is specified) authors (optional list which should correspond to the file names in `data/authors`. Uses `default` if none is specified)
layout (optional list which should correspond to the file names in `data/layouts`) layout (optional list which should correspond to the file names in `data/layouts`)
canonical (optional, canonical url for the post for SEO) canonicalUrl (optional, canonical url for the post for SEO)
``` ```
Here's an example of a post's frontmatter: Here's an example of a post's frontmatter:
@ -182,7 +182,7 @@ summary: 'Looking for a performant, out of the box template, with all the best i
images: ['/static/images/canada/mountains.jpg', '/static/images/canada/toronto.jpg'] images: ['/static/images/canada/mountains.jpg', '/static/images/canada/toronto.jpg']
authors: ['default', 'sparrowhawk'] authors: ['default', 'sparrowhawk']
layout: PostLayout layout: PostLayout
canonical: https://tailwind-nextjs-starter-blog.vercel.app/blog/introducing-tailwind-nextjs-starter-blog canonicalUrl: https://tailwind-nextjs-starter-blog.vercel.app/blog/introducing-tailwind-nextjs-starter-blog
--- ---
``` ```

View File

@ -27,7 +27,6 @@ const CommonSEO = ({ title, description, ogType, ogImage, twImage, canonicalUrl
<link <link
rel="canonical" rel="canonical"
href={canonicalUrl ? canonicalUrl : `${siteMetadata.siteUrl}${router.asPath}`} href={canonicalUrl ? canonicalUrl : `${siteMetadata.siteUrl}${router.asPath}`}
key={'canonicalUrl'}
/> />
</Head> </Head>
) )

View File

@ -146,7 +146,7 @@ summary (optional)
images (optional, if none provided defaults to socialBanner in siteMetadata config) images (optional, if none provided defaults to socialBanner in siteMetadata config)
authors (optional list which should correspond to the file names in `data/authors`. Uses `default` if none is specified) authors (optional list which should correspond to the file names in `data/authors`. Uses `default` if none is specified)
layout (optional list which should correspond to the file names in `data/layouts`) layout (optional list which should correspond to the file names in `data/layouts`)
canonical (optional, canonical url for the post for SEO) canonicalUrl (optional, canonical url for the post for SEO)
``` ```
Here's an example of a post's frontmatter: Here's an example of a post's frontmatter:
@ -162,7 +162,7 @@ summary: 'Looking for a performant, out of the box template, with all the best i
images: ['/static/images/canada/mountains.jpg', '/static/images/canada/toronto.jpg'] images: ['/static/images/canada/mountains.jpg', '/static/images/canada/toronto.jpg']
authors: ['default', 'sparrowhawk'] authors: ['default', 'sparrowhawk']
layout: PostLayout layout: PostLayout
canonical: https://tailwind-nextjs-starter-blog.vercel.app/blog/introducing-tailwind-nextjs-starter-blog canonicalUrl: https://tailwind-nextjs-starter-blog.vercel.app/blog/introducing-tailwind-nextjs-starter-blog
--- ---
``` ```

View File

@ -7,7 +7,7 @@ draft: false
summary: 'An overview of the new features released in v1 - code block copy, multiple authors, frontmatter layout and more' summary: 'An overview of the new features released in v1 - code block copy, multiple authors, frontmatter layout and more'
layout: PostSimple layout: PostSimple
bibliography: references-data.bib bibliography: references-data.bib
canonicalUrl: https://example.com/ canonicalUrl: https://tailwind-nextjs-starter-blog.vercel.app/blog/new-features-in-v1/
--- ---
## Overview ## Overview

View File

@ -40,7 +40,7 @@ const genFrontMatter = (answers) => {
summary: ${answers.summary ? answers.summary : ' '} summary: ${answers.summary ? answers.summary : ' '}
images: [] images: []
layout: ${answers.layout} layout: ${answers.layout}
canonical: ${answers.canonical} canonicalUrl: ${answers.canonicalUrl}
` `
if (answers.authors.length > 0) { if (answers.authors.length > 0) {
@ -94,7 +94,7 @@ inquirer
choices: getLayouts, choices: getLayouts,
}, },
{ {
name: 'canonical', name: 'canonicalUrl',
message: 'Enter canonical url:', message: 'Enter canonical url:',
type: 'input', type: 'input',
}, },