kurtsson / jekyll-multiple-languages-plugin

I18n support for Jekyll and Octopress
MIT License
923 stars 201 forks source link

Compatibility with jekyll-seo-tag #143

Open josephgarnier opened 5 years ago

josephgarnier commented 5 years ago

Hi,

I created a template like this :

id: about layout: page title: pages.about.title display-title: true permalink: /about button: true order: 3

{% translate_file pages/about.md %}

My problem is that jekyll-seo-tag doesn't read the value associated with the key pages.about.title in title tag, but display the key : <title>pages.about.title</title>. How could I fix it ? Maybe in changing the order of jekyll-multiple-languages-plugin with a priority higher than this of jekyll-seo-tag ?

hanniabu commented 4 years ago

Hey @josephgarnier, I had the same issue and resolved it by doing this:

about.md:

---
title: listings.meta_title
description: listings.meta_description
keywords: listings.meta_keywords
layout: default
---

_i18n/en.yml:

global:
  lang: English
  meta_title: Site Title
  meta_description: This is the site description
  meta_keywords: these, are, your, site, keywords
about:
  meta_title: About
  meta_description: This is the About page description.
  meta_keywords: these, are, your, about, page, keywords

head.md:

{% assign global = site.translations[site.lang].global %}

{% assign title = site.translations[site.lang].global.meta_title %}
  {% if page.title %}
    {% capture page_title %}{% t page.title %} | {{ title }}{% endcapture %}
    {% assign title = page_title %}
  {% endif %}

{% assign description = site.translations[site.lang].global.meta_descritpion %}
  {% if page.description %}
    {% capture page_description %}{% t page.description %}{% endcapture %}
    {% assign description = page_description %}
  {% endif %}

{% assign keywords = site.translations[site.lang].global.meta_keywords %}
  {% if page.keywords %}
    {% capture page_keywords %}{% t page.keywords %}{% endcapture %}
    {% assign keywords = page_keywords %}
  {% endif %}

<head>
  <meta name="keywords" content="{{ keywords }}">
  <meta name="description" content="{{ description }}">
  <title>{{ title }}</title>
</head>
trasher commented 4 years ago

Just for information: https://github.com/jekyll/jekyll-seo-tag/issues/373