Custom Meta Title and Description for each Tag / Category

Normally in jekyll we can add custom meta title/ description conditionally for the pages, posts but for the category / tag specially built with autopages ( paginate-v2 ) plugins. Is there any good option to put custom meta title, description for each tag / category?

Any ideas appreciated.

1 Like

Oh, man, good question! I am also interesting about it.

Can I set custom Title, Description and URL for categories on Jekyll?

And then how to work Front Matter of the post’s? If I write category cat on the post’s Front Matter.

Then for cat page (categories page) I write permalink: cat-category. How will it work? Permalink of the cat's category should be cat, or cat-category?

Yes. For example, https://docs.themeix.com/eduzone-jekyll-theme/ that is a tag page. But we can’t set a custom title and description for that page, because its generated by auto pages and if we apply a title it will applicable in all tag page. which is not SEO friendly.

Yes. For example, https://docs.themeix.com/eduzone-jekyll-theme/ that is a tag page. But we can’t set a custom title and description for that page, because its generated by auto pages and if we apply a title it will applicable in all tag page. which is not SEO friendly.

What, if you use categories instead of tags? Then write Front Matter for category pages to display custom Titles, Descriptions etc? Will it work right for you?

Now i am using the following code the post purpose. There tags and categories are different and the same post associating with many tags. It’s really hard to manage tag pages individually as static when writing a post.

---
layout: doc_full
title:  "Setup Navigation Menu"
date:   2018-09-18 18:51:30 +0600
tags: [Eduzone Jekyll Theme, Churel Jekyll Theme]
categories: [Jekyll]
order: 6
---

Ok, thanks for the answer. I will wait for the answers of other people, maybe they will help.

Sir, and can you answer my question? I asked my question above.

Actually some people make data collection folder for the category, tag, author etc manually. It could help but i don’t think its an idea way. But may be only the way it is. Let’s see what’s the other creative peoples thinking about it.

For jekyll-paginate-v2 using the Autopages method you’re somewhat limited since it’s using the values found in site.categories and site.tags and all you have is the slug and title for each category and tag.

What I did was create a YAML file and placed that in _data which I then add descriptions and alternate titles for various tags. By using a simple key/pair mapping you can access these values as Autopages generates each taxonomy page. This method would also work for the jekyll-archives plugin.

In my YAML file I do something like this for each tag I want a special description or title for:

# _data/taxonomy.yml

jekyll:
  title: "Jekyll"
  description: "An archive of posts related to Jekyll --- a Ruby Gem that transforms plain text into static websites and blogs."

Then in my Autopages tag layout I do something like this:

{% if page.layout == 'autopage_tags' %}
  {% assign taxonomy = page.autopages.display_name | downcase | slugify %}
  {% assign tag = site.data.taxonomy[taxonomy] %}
{% endif %}

{% if page.layout == 'autopage_tags' %}
  {% if tag.description %}
    {% assign description = tag.description %}
  {% else %}
    {% assign description = page.autopages.display_name | prepend: 'An archive of posts tagged ' %}
  {% endif %}
{% endif %}

<meta description="{{ description }}">

Where things get tricky is if you use jekyll-seo-tag. I don’t think there’s an easy way to push these custom descriptions and titles to that without monkey patching that plugin.