Skip to content
Snippets Groups Projects
Select Git revision
  • fc8f2c94b721fb0cc909cc9577372ba7b6906ac6
  • main default protected
2 results

RESULTS

Blame
  • seo.html 6.21 KiB
    <!-- begin _includes/seo.html -->
    {%- if site.url -%}
      {%- assign seo_url = site.url | append: site.baseurl -%}
    {%- endif -%}
    {%- assign seo_url = seo_url | default: site.github.url -%}
    
    {% assign title_separator = site.title_separator | default: '-' | replace: '|', '&#124;' %}
    
    {%- if page.title -%}
      {%- assign seo_title = page.title | append: " " | append: title_separator | append: " " | append: site.title -%}
    {%- endif -%}
    
    {%- if seo_title -%}
      {%- assign seo_title = seo_title | markdownify | strip_html | strip_newlines | escape_once -%}
    {%- endif -%}
    
    {% if page.canonical_url %}
      {%- assign canonical_url = page.canonical_url %}
    {% else %}
      {%- assign canonical_url = page.url | replace: "index.html", "" | absolute_url %}
    {% endif %}
    
    {%- assign seo_description = page.description | default: page.excerpt | default: site.description -%}
    {%- if seo_description -%}
      {%- assign seo_description = seo_description | markdownify | strip_html | strip_newlines | escape_once -%}
    {%- endif -%}
    
    <!-- don't use page.author even if it is set, find author based on url -->
    {% assign author = page.url | split: "/" %}
    {% assign author = author[1] %}
    {% assign author = site.data.authors.authors | where: "prefix", author | first %}
    
    {%- if author.twitter -%}
      {%- assign author_twitter = author.twitter | replace: "@", "" -%}
    {%- endif -%}
    
    {%- assign page_large_image = page.og_image | default: author.og_image | default: author.avatar | default: page.overlay_image | default: page.header.image -%}
    {%- unless page_large_image contains '://' -%}
      {%- assign page_large_image = page_large_image | absolute_url -%}
    {%- endunless -%}
    {%- assign page_large_image = page_large_image | escape -%}
    
    {%- assign page_teaser_image = page.header.teaser | default: site.og_image -%}
    {%- unless page_teaser_image contains '://' -%}
      {%- assign page_teaser_image = page_teaser_image | absolute_url -%}
    {%- endunless -%}
    {%- assign page_teaser_image = page_teaser_image | escape -%}
    
    {%- assign site_og_image = site.og_image -%}
    {%- unless site_og_image contains '://' -%}
      {%- assign site_og_image = site_og_image | absolute_url -%}
    {%- endunless -%}
    {%- assign site_og_image = site_og_image | escape -%}
    
    {%- if page.date -%}
      {%- assign og_type = "article" -%}
    {%- else -%}
      {%- 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>
    <meta name="description" content="{{ seo_description }}">
    
    {% if author.name %}
      <meta name="author" content="{{ author.name | default: author }}">
    {% endif %}
    
    <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 }}">