mirror of
https://github.com/hacks-guide/minimal-mistakes.git
synced 2024-11-26 18:30:28 +00:00
Fix SEO title when it contains a vertical bar (#3113)
* Do not markdownify title * Support markup in titles * Support markup in titles * Fix seo.html as reviewed * seo_title is now unconditionally computed --------- Co-authored-by: iBug <git@ibugone.com>
This commit is contained in:
parent
9c386c5509
commit
dfaac405f0
@ -4,15 +4,13 @@
|
||||
{%- endif -%}
|
||||
{%- assign seo_url = seo_url | default: site.github.url -%}
|
||||
|
||||
{% assign title_separator = site.title_separator | default: '-' | replace: '|', '|' %}
|
||||
{% assign title_separator = site.title_separator | default: '-' %}
|
||||
|
||||
{%- if page.title -%}
|
||||
{%- assign seo_title = page.title | append: " " | append: title_separator | append: " " | append: site.title -%}
|
||||
{%- endif -%}
|
||||
{%- assign page_title = page.title | default: site.title | replace: '|', '|' -%}
|
||||
{%- assign seo_title = page_title | append: " " | append: title_separator | append: " " | append: site.title | replace: '|', '|' -%}
|
||||
|
||||
{%- if seo_title -%}
|
||||
{%- assign page_title = page_title | markdownify | strip_html | strip_newlines | escape_once -%}
|
||||
{%- assign seo_title = seo_title | markdownify | strip_html | strip_newlines | escape_once -%}
|
||||
{%- endif -%}
|
||||
|
||||
{% if page.canonical_url %}
|
||||
{%- assign canonical_url = page.canonical_url %}
|
||||
@ -47,7 +45,7 @@
|
||||
{%- assign og_type = "website" -%}
|
||||
{%- endif -%}
|
||||
|
||||
<title>{{ seo_title | default: site.title }}{% if paginator %}{% unless paginator.page == 1 %} {{ title_separator }} {{ site.data.ui-text[site.locale].page | default: "Page" }} {{ paginator.page }}{% endunless %}{% endif %}</title>
|
||||
<title>{{ seo_title }}{% if paginator %}{% unless paginator.page == 1 %} {{ title_separator }} {{ site.data.ui-text[site.locale].page | default: "Page" }} {{ paginator.page }}{% endunless %}{% endif %}</title>
|
||||
<meta name="description" content="{{ seo_description }}">
|
||||
|
||||
{% if author.name %}
|
||||
@ -60,7 +58,7 @@
|
||||
<meta property="og:type" content="{{ og_type }}">
|
||||
<meta property="og:locale" content="{{ site.locale | replace: "-", "_" | default: "en_US" }}">
|
||||
<meta property="og:site_name" content="{{ site.title }}">
|
||||
<meta property="og:title" content="{{ page.title | default: site.title | markdownify | strip_html | strip_newlines | escape_once }}">
|
||||
<meta property="og:title" content="{{ page_title }}">
|
||||
<meta property="og:url" content="{{ canonical_url }}">
|
||||
|
||||
{% if seo_description %}
|
||||
@ -75,7 +73,7 @@
|
||||
|
||||
{% if site.twitter.username %}
|
||||
<meta name="twitter:site" content="@{{ site.twitter.username | replace: "@", "" }}">
|
||||
<meta name="twitter:title" content="{{ page.title | default: site.title | markdownify | strip_html | strip_newlines | escape_once }}">
|
||||
<meta name="twitter:title" content="{{ page_title }}">
|
||||
<meta name="twitter:description" content="{{ seo_description }}">
|
||||
<meta name="twitter:url" content="{{ canonical_url }}">
|
||||
|
||||
|
@ -22,7 +22,7 @@ layout: default
|
||||
{% include sidebar.html %}
|
||||
|
||||
<article class="page" itemscope itemtype="https://schema.org/CreativeWork">
|
||||
{% if page.title %}<meta itemprop="headline" content="{{ page.title | markdownify | strip_html | strip_newlines | escape_once }}">{% endif %}
|
||||
{% if page.title %}<meta itemprop="headline" content="{{ page.title | replace: '|', '|' | markdownify | strip_html | strip_newlines | escape_once }}">{% endif %}
|
||||
{% if page.excerpt %}<meta itemprop="description" content="{{ page.excerpt | markdownify | strip_html | strip_newlines | escape_once }}">{% endif %}
|
||||
{% if page.date %}<meta itemprop="datePublished" content="{{ page.date | date_to_xmlschema }}">{% endif %}
|
||||
{% if page.last_modified_at %}<meta itemprop="dateModified" content="{{ page.last_modified_at | date_to_xmlschema }}">{% endif %}
|
||||
|
Loading…
Reference in New Issue
Block a user