Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[gatsby-theme-minimal-blog]: Canonical URL support #493

Closed
aleccool213 opened this issue Sep 24, 2020 · 0 comments · Fixed by #494
Closed

[gatsby-theme-minimal-blog]: Canonical URL support #493

aleccool213 opened this issue Sep 24, 2020 · 0 comments · Fixed by #494
Labels
type: enhancement An issue or pull request that adds a feature or enhances a current one

Comments

@aleccool213
Copy link
Contributor

Love the theme 👍 Hope to use it but I require this feature.

Summary

For most blogs, cross posting a piece of content is common. If you post a piece of content on multiple sources, search engines need a Canonical URL to be able to figure out what is the source of truth.

ref: https://www.shopify.com/partners/blog/canonical-urls

Basic example

In the front-matter of a post, add the canonical_url header which would add

Example:

---
title: A Better Way to use GraphQL Fragments in React
banner: ./images/photo1.jpg
date: "2020-05-11T22:12:03.284Z"
canonical_url: "https://medium.com/@yourboybigal/a-better-way-to-use-graphql-fragments-in-react-4f54bf862062"
description: Defining fragments inside the components that render data brings many benefits.
slug: "/better-way-to-use-graphql-in-react/"
---

Would result in this header tag being added to the blog post:

<link rel="canonical" href="https://medium.com/@yourboybigal/a-better-way-to-use-graphql-fragments-in-react-4f54bf862062">

Motivation

I cross-post my posts to dev.to and Medium and this is required for me to use this theme.

Note

I have implemented this a few times in other Gatsby sites so I dont mind tackling this.

@aleccool213 aleccool213 added the type: enhancement An issue or pull request that adds a feature or enhances a current one label Sep 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement An issue or pull request that adds a feature or enhances a current one
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant