Okay, I think I better understand your requirement. What Jekyll SEO [mostly] does is add HTML <meta>
tags to your pages. According to the Advanced usage documentation, you can overwrite those defaults.
I do not use Jekyll SEO since I create my own tags, but according to the documentation, the following approach should work.
Using the Jekyll Minima theme as an example, nearly every page uses the default
layout. That layout in turn includes the head.html
file. It is in that file where you will find the Jekyll SEO tag in use. Looks for the line that reads {%- seo -%}
. Note also that the <title>
tag always lives in the <head>
tag of your HTML document.
According to the Jekyll SEO documentation link I shared, this modification to the /_includes/head.html
file would give you what you need:
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
{%- seo title=false -%}
{%- seo -%}
{%- assign newTitle = page.title | append: ' - ' | append: page.author | escape -%}
<title>{{-newTitle-}}</title>
<link rel="stylesheet" href="{{ "/assets/main.css" | relative_url }}">
{%- feed_meta -%}
{%- if jekyll.environment == 'production' and site.google_analytics -%}
{%- include google-analytics.html -%}
{%- endif -%}
</head>
Notice that I include {%- seo title=false -%}
just before {%- seo -%}
. According to the docs, that should prevent the <title>
tag from displaying.
Right after the {%- seo -%}
line, I create a variable called newTitle
, which happens to be the title of the page concatenated with the author.
Finally, right after that line, I use the variable by adding <title>{{-newTitle-}}</title>
Since I was not able to test this code beforehand, go ahead and give it a try. Assuming no errors, open the web page in the browser, right-click and choose the option to view the source code. You should only see one <title>
tag within the <head>
tag and it should be the title you created with the Liquid variable.
You said you use collections, so if you want a different <title>
tag per collection, then you will have to figure out how you want to handle that (more layouts, more include files, if
logic, etc.)
Hand-coding your SEO tags is not that complicated and can be done without a plugin. If you want to replace it with your own Liquid code, go to the readme.md
file at the Jekyll SEO GitHub page to learn how it works: