|
| 1 | + |
| 2 | +{% if page.title %} |
| 3 | + {% assign page_title = page.title | escape %} |
| 4 | +{% else %} |
| 5 | + {% assign page_title = site.title | escape %} |
| 6 | +{% endif %} |
| 7 | + |
| 8 | + |
| 9 | +{% if page.author.name %} |
| 10 | + {% assign page_author = page.author.name | default: nil | escape %} |
| 11 | + {% assign twitter_creator = page.twitter.username | default: site.twitter.site | default: nil | escape %} |
| 12 | +{% else %} |
| 13 | + {% assign page_author = site.author.name | default: nil | escape %} |
| 14 | + {% assign twitter_creator = site.twitter.username | default: nil | escape %} |
| 15 | +{% endif %} |
| 16 | + |
| 17 | +{% assign page_description = page.excerpt | default: page.tagline | default: site.description | strip_html | normalize_whitespace | truncate: 300 | escape %} |
| 18 | + |
| 19 | +{%if page.image %} |
| 20 | + {% assign page_image = page.image | absolute_url %} |
| 21 | +{%else if site.image %} |
| 22 | + {% assign page_image = site.image | absolute_url %} |
| 23 | +{%endif %} |
| 24 | + |
| 25 | +{% assign abs_url = '' | absolute_url %} |
| 26 | +{% assign canonical_url = page.url | replace:'index.html','' | prepend: abs_url %} |
| 27 | + |
| 28 | +<!-- Place this data between the <head> tags of your website --> |
| 29 | +{%if page_author %} |
| 30 | + <meta name="author" content="{{ page_author }}" /> |
| 31 | +{%endif %} |
| 32 | +<meta name="description" content="{{ page_description }}" /> |
| 33 | +{%if page.tags.size > 0 %} |
| 34 | + <meta name="keywords" itemprop="tags" content="{{ page.tags | join: ', ' | escape }}"/> |
| 35 | +{%endif %} |
| 36 | +{%if page.keywords %} |
| 37 | + <meta name="keywords" itemprop="keywords" content="{{ page.keywords | escape }}" /> |
| 38 | +{%endif %} |
| 39 | +{%if page.categories.size > 0 %} |
| 40 | + <meta name="keywords" itemprop="categories" content="{{ page.categories | join: ', ' | escape }}" /> |
| 41 | +{%endif %} |
| 42 | +{%if page.category %} |
| 43 | + <meta name="keywords" itemprop="category" content="{{ category | escape }}" /> |
| 44 | +{%endif %} |
| 45 | + |
| 46 | +<!-- Twitter Card data --> |
| 47 | +<meta name="twitter:card" content="summary_large_image" /> |
| 48 | + |
| 49 | +{%if site.twitter.site %} |
| 50 | + <meta name="twitter:site" content="@{{ site.twitter.site }}" /> |
| 51 | +{%endif %} |
| 52 | + |
| 53 | +<meta name="twitter:title" content="{{ page_title }}" /> |
| 54 | +<meta name="twitter:description" content="{{ page_description }}" /> |
| 55 | + |
| 56 | +{%if twitter_creator %} |
| 57 | + <meta name="twitter:creator" content="@{{ twitter_creator }}" /> |
| 58 | +{%endif %} |
| 59 | + |
| 60 | +<!-- Twitter summary card with large image must be at least 280x150px --> |
| 61 | +{%if page_image %} |
| 62 | + <meta name="twitter:image:src" content="{{ page_image }}" /> |
| 63 | + <meta name="twitter:image" content="{{ page_image }}" /> |
| 64 | +{%endif %} |
| 65 | +<meta name="twitter:url" content="{{ canonical_url }}" /> |
| 66 | + |
| 67 | +<!-- Open Graph data --> |
| 68 | +<meta property="og:title" content="{{ page_title }}" /> |
| 69 | +<meta property="og:type" content="article" /> |
| 70 | +<meta property="og:url" content="{{ canonical_url }}" /> |
| 71 | + |
| 72 | +{%if page_image %} |
| 73 | + <meta property="og:image" content="{{ page_image }}" /> |
| 74 | +{%endif %} |
| 75 | +<meta property="og:description" content="{{ page_description }}" /> |
| 76 | +<meta property="og:site_name" content="{{ site.title }}" /> |
| 77 | + |
| 78 | +{% if page-lang == "en" %} |
| 79 | + {% assign page-lang-country = "en_US" %} |
| 80 | +{% elsif page-lang == "it" %} |
| 81 | + {% assign page-lang-country = "it_IT" %} |
| 82 | +{% endif %} |
| 83 | +<meta property="og:locale" content="{{ page-lang-country }}" /> |
| 84 | + |
| 85 | +{%if page.date %} |
| 86 | + <meta property="article:published_time" content="{{ page.date | date_to_xmlschema }}" /> |
| 87 | +{%endif %} |
| 88 | +{%if page.modified_date %} |
| 89 | +<meta property="og:updated_time" content="{{ page.modified_date | date_to_xmlschema }}" /> |
| 90 | +<meta property="article:modified_time" content="{{ page.modified_date | date_to_xmlschema }}" /> |
| 91 | +{%endif %} |
| 92 | + |
| 93 | +{%if page.tags %} |
| 94 | + {% for tag in page.tags %} |
| 95 | + <meta property="article:tag" content="{{ tag | escape }}" /> |
| 96 | + {% endfor %} |
| 97 | +{%endif %} |
| 98 | + |
| 99 | +{%if page.keywords %} |
| 100 | + {% assign keywordsList = page.keywords | split:', ' %} |
| 101 | + {% for keyword in keywordsList %} |
| 102 | + <meta property="article:tag" content="{{ keyword | escape }}" /> |
| 103 | + {% endfor %} |
| 104 | +{%endif %} |
| 105 | + |
| 106 | +{%if page.categories %} |
| 107 | + {% for category in page.categories %} |
| 108 | + <meta property="article:tag" content="{{ category | escape }}" /> |
| 109 | + {% endfor %} |
| 110 | +{%endif %} |
| 111 | + |
| 112 | +{%if page.category %} |
| 113 | + <meta property="article:tag" content="{{ category | escape }}" /> |
| 114 | +{%endif %} |
0 commit comments