_includes/variables.html in jekyll-theme-plain-0.7.0 vs _includes/variables.html in jekyll-theme-plain-0.8.0

- old
+ new

@@ -1,23 +1,23 @@ {%- comment -%} - # Whether the page is in the plain layout. + # Whether the page is a post. {%- endcomment -%} -{%- if page.layout == "plain" or page.layout == "post" -%} - {%- assign is_plain = true -%} +{%- if page.layout == "post" -%} + {%- assign is_post = true -%} {%- endif -%} {%- comment -%} # Default values. {%- endcomment -%} {%- assign default_lang = "en" -%} {%- assign default_charset = "utf-8" -%} {%- assign default_color_scheme = "light dark" -%} {%- assign default_viewport = "width=device-width, initial-scale=1" -%} -{%- assign default_title = "" -%} +{%- assign default_title = nil -%} {%- assign default_canonical_url = page.url | absolute_url -%} -{%- assign default_license_url = false -%} -{%- assign default_stylesheets = "" | split: ", " -%} +{%- assign default_license_url = nil -%} +{%- assign default_stylesheets = nil -%} {%- comment -%} # Lang. {%- endcomment -%} {%- assign lang = page.lang -%} @@ -53,22 +53,25 @@ {%- if canonical_url == nil -%}{%- assign canonical_url = default_canonical_url -%}{%- endif -%}{%- endif -%} {%- comment -%} # Title. {%- endcomment -%} -{%- if is_plain -%} +{%- assign title = page.title -%} +{%- if title == nil -%}{%- assign title = site.title -%} +{%- if title == nil -%}{%- assign title = default_title -%}{%- endif -%}{%- endif -%} + +{%- comment -%} + # If the title is empty, sets the canonical URL as the title. +{%- endcomment -%} +{%- if title.size == 0 -%} {%- assign title = canonical_url | remove_first: "https://www." | remove_first: "http://www." | remove_first: "https://" | remove_first: "http://" -%} -{%- else -%} - {%- assign title = page.title -%} - {%- if title == nil -%}{%- assign title = site.title -%} - {%- if title == nil -%}{%- assign title = default_title -%}{%- endif -%}{%- endif -%} {%- endif -%} {%- comment -%} # License url. {%- endcomment -%}