diff --git a/docs/usage.md b/docs/usage.md index 78fcf07..489c233 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -66,7 +66,8 @@ The following properties are available: yandex: 1234 baidu: 1234 ``` -* `lang` - The locale these tags are marked up in. Of the format `language_TERRITORY`. Default is `en_US`. +* `locale` - The locale these tags are marked up in. Of the format `language_TERRITORY`. Default is `en_US`. Takes priority +over existing config key `lang`. The SEO tag will respect the following YAML front matter if included in a post, page, or document: @@ -74,6 +75,6 @@ The SEO tag will respect the following YAML front matter if included in a post, * `description` - A short description of the page's content * `image` - URL to an image associated with the post, page, or document (e.g., `/assets/page-pic.jpg`) * `author` - Page-, post-, or document-specific author information (see [Advanced usage](advanced-usage.md#author-information)) -* `lang` - Page-, post-, or document-specific language information +* `locale` - Page-, post-, or document-specific locale information. Takes priority over existing front matter attribute `lang`. *Note:* Front matter defaults can be used for any of the above values as described in advanced usage with an image example. diff --git a/lib/jekyll-seo-tag/drop.rb b/lib/jekyll-seo-tag/drop.rb index cb806d6..bd3710c 100644 --- a/lib/jekyll-seo-tag/drop.rb +++ b/lib/jekyll-seo-tag/drop.rb @@ -164,6 +164,10 @@ module Jekyll @page_lang ||= page["lang"] || site["lang"] || "en_US" end + def page_locale + @page_locale ||= (page["locale"] || site["locale"] || page_lang).tr("-", "_") + end + def canonical_url @canonical_url ||= begin if page["canonical_url"].to_s.empty? diff --git a/lib/template.html b/lib/template.html index d7aea1b..bc507e7 100755 --- a/lib/template.html +++ b/lib/template.html @@ -13,7 +13,7 @@ {% endif %} - + {% if seo_tag.description %}