jekyll / jekyll-seo-tag

A Jekyll plugin to add metadata tags for search engines and social networks to better index and display your site's content.
https://jekyll.github.io/jekyll-seo-tag
MIT License
1.66k stars 294 forks source link

Title Tag Inheritance Mixup, what am I doing wrong? #425

Closed Timothep closed 3 years ago

Timothep commented 3 years ago

Hi there, I'm not sure what I am doing wrong, but I can't seem to get the titles to work correctly. I am using Github pages, which is pulling the Jekyll SEO Tag v2.6.1. The repo is publicly available here: https://github.com/DevJourneyFm/DevJourneyFm.github.io

1- In my _config.yml file I have a default "title: DevJourney Podcast" 2- In my _layout, I add the {% SEO %} call, this layout is used by every page 2- In my index.html I have "title: Home" 3- Most of my other pages have custom titles, ex: "title: #127 Emmanuel Bernard" 4- Some pages don't have any title

As is, the title defaults to:

If I remove the tag in _config.yml the title defaults to:

Any idea what I am doing wrong?

ashmaroli commented 3 years ago

In YAML, the hash character # denotes a start of comment. So technically, title: #130 Foobar is parsed into {"title" => nil} So you should quote your values to tell the parser that it is part of the string value.

Notice how GitHub highlights the following samples:

---
layout: default
comments: true
title: #130 Natalia Tepluhina
description: #130 Natalia Tepluhina a DBA turned Vue.js-expert at Gitlab
---
layout: default
comments: true
title: "#130 Natalia Tepluhina"
description: '#130 Natalia Tepluhina a DBA turned Vue.js-expert at Gitlab'
Timothep commented 3 years ago

Holly Molly, of course, when your nose is stuck onto it, you can't see the wood for the trees!!! Big thanks @ashmaroli, that was it of course 😍