DEV Community

abdellah ht
abdellah ht

Posted on

How to Add a Canonical URL to Your dev.to Post

Hello dev.to community! 👋

If you're here, you probably already have a few posts under your belt and are familiar with using front matter to add metadata to your dev.to articles. Adding a canonical URL is a crucial step for those of us who cross-post content from our personal blogs or other platforms. It helps with SEO by indicating the original source of your content, ensuring search engines know where the content was first published.

Step-by-Step Guide to Adding a Canonical URL

  1. Open Your Post in the Editor

    • Navigate to your dev.to dashboard and open the post you want to edit. If you’re creating a new post, start a new draft.
  2. Access the Markdown Editor

    • Make sure you’re in the markdown editor. This is where you’ll add your front matter.
  3. Modify the Front Matter

    • At the top of your post, you should already have some front matter in YAML format. This is where you add metadata like the title, description, and tags.
  4. Add the Canonical URL

    • Include the canonical_url field in your front matter. Here’s how your front matter should look:
   ---
   title: "Your Post Title"
   published: true
   description: "A brief description of your post"
   tags: programming, tutorial, devto
   canonical_url: "https://yourwebsite.com/your-original-post"
   ---

   Your post content goes here... 
Enter fullscreen mode Exit fullscreen mode

Replace https://yourwebsite.com/your-original-post with the actual URL of your original content.

  1. Save and Publish After adding the canonical URL, save your changes and publish your post. This will tell search engines that the original source of the content is the URL you provided, helping to avoid duplicate content issues.

If you liked this post, give it a 🦄 :)

Top comments (0)