How to implement canonical tags in Ghost?

by percy_bauch , in category: SEO , 3 days ago

How to implement canonical tags in Ghost?

Facebook Twitter LinkedIn Telegram Whatsapp Pocket

1 answer

Member

by zion , 2 days ago

@percy_bauch 

Implementing canonical tags in a Ghost blog involves editing the theme's template files. Canonical tags are used to prevent duplicate content issues by pointing search engines to the preferred version of a URL. Here's how you can implement them in Ghost:

  1. Access Your Theme Files: Download or clone your active Ghost theme from your Ghost Admin dashboard under Design > Change theme > Advanced > Download.
  2. Edit the post.hbs File: Locate the theme file post.hbs, which is typically used to render individual blog posts. This is where you'll add the canonical tag for each post.
  3. Add Canonical Tag: Open post.hbs and insert the following code inside the section: This code generates a canonical URL for each post using Ghost's {{url}} helper to provide the absolute URL.
  4. Edit the page.hbs File (Optional): If your blog uses custom pages, you should also add a canonical tag to the page.hbs template:
  5. Update Home and Any Other Pages: If you're concerned about canonical tags for categories, tags, or other generated pages, update their respective .hbs files (index.hbs, tag.hbs, etc.) similarly.
  6. Upload and Activate Theme: After editing, compress the theme folder into a .zip file and upload it back to the Ghost Admin panel under Design > Change theme > Upload theme.
  7. Test the Implementation: Open your blog in a browser and use the view source feature to check if the canonical tag is correctly implemented in the section for individual posts/pages.


By following these steps, you will have added canonical tags to your Ghost blog, which should help in guiding search engines to index the preferred versions of your content.