|
| 1 | +<!-- Advanced SEO Meta Tags --> |
| 2 | +<meta charset="utf-8"> |
| 3 | +<meta name="viewport" content="width=device-width, initial-scale=1"> |
| 4 | + |
| 5 | +<!-- Standard SEO Tags --> |
| 6 | +{%- assign page_title = page.title | default: site.title -%} |
| 7 | +{%- assign page_description = page.description | default: page.excerpt | default: site.description | strip_html | truncatewords: 50 -%} |
| 8 | +{%- assign page_image = page.image | default: site.logo | absolute_url -%} |
| 9 | +{%- assign page_url = page.url | absolute_url -%} |
| 10 | + |
| 11 | +<!-- Keywords generation --> |
| 12 | +{%- assign page_keywords = "" -%} |
| 13 | +{%- if page.tags and page.tags.size > 0 -%} |
| 14 | + {%- assign page_keywords = page.tags | join: ", " -%} |
| 15 | +{%- elsif page.categories and page.categories.size > 0 -%} |
| 16 | + {%- assign page_keywords = page.categories | join: ", " -%} |
| 17 | +{%- endif -%} |
| 18 | + |
| 19 | +{%- if page_keywords == "" -%} |
| 20 | + {%- assign page_keywords = "HMPL, JavaScript, templating, web development" -%} |
| 21 | + {%- if page.title -%} |
| 22 | + {%- assign title_words = page.title | split: " " | join: ", " -%} |
| 23 | + {%- assign page_keywords = page_keywords | append: ", " | append: title_words -%} |
| 24 | + {%- endif -%} |
| 25 | +{%- else -%} |
| 26 | + {%- assign page_keywords = page_keywords | append: ", HMPL, JavaScript, templating, web development" -%} |
| 27 | +{%- endif -%} |
| 28 | + |
| 29 | +<meta name="description" content="{{ page_description }}"> |
| 30 | +<meta name="keywords" content="{{ page_keywords }}"> |
| 31 | +<meta name="author" content="{{ page.author | default: site.author.name }}"> |
| 32 | + |
| 33 | +<!-- Open Graph / Facebook --> |
| 34 | +<meta property="og:type" content="{% if page.layout == 'post' %}article{% else %}website{% endif %}"> |
| 35 | +<meta property="og:title" content="{{ page_title }}"> |
| 36 | +<meta property="og:description" content="{{ page_description }}"> |
| 37 | +<meta property="og:image" content="{{ page_image }}"> |
| 38 | +<meta property="og:url" content="{{ page_url }}"> |
| 39 | +<meta property="og:site_name" content="{{ site.title }}"> |
| 40 | +{%- if page.layout == 'post' -%} |
| 41 | +<meta property="article:published_time" content="{{ page.date | date_to_xmlschema }}"> |
| 42 | +{%- if page.modified_date -%} |
| 43 | +<meta property="article:modified_time" content="{{ page.modified_date | date_to_xmlschema }}"> |
| 44 | +{%- endif -%} |
| 45 | +<meta property="article:author" content="{{ page.author | default: site.author.name }}"> |
| 46 | +{%- if page.tags -%} |
| 47 | +{%- for tag in page.tags -%} |
| 48 | +<meta property="article:tag" content="{{ tag }}"> |
| 49 | +{%- endfor -%} |
| 50 | +{%- endif -%} |
| 51 | +{%- endif -%} |
| 52 | + |
| 53 | +<!-- Twitter --> |
| 54 | +<meta name="twitter:card" content="summary_large_image"> |
| 55 | +<meta name="twitter:title" content="{{ page_title }}"> |
| 56 | +<meta name="twitter:description" content="{{ page_description }}"> |
| 57 | +<meta name="twitter:image" content="{{ page_image }}"> |
| 58 | +<meta name="twitter:site" content="@hmpljs"> |
| 59 | +<meta name="twitter:creator" content="@hmpljs"> |
| 60 | + |
| 61 | +<!-- Additional SEO --> |
| 62 | +<meta name="robots" content="index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1"> |
| 63 | +<meta name="googlebot" content="index, follow"> |
| 64 | +<link rel="canonical" href="{{ page_url }}"> |
| 65 | + |
| 66 | +<!-- Schema.org JSON-LD --> |
| 67 | +<script type="application/ld+json"> |
| 68 | +{ |
| 69 | + "@context": "https://schema.org", |
| 70 | + "@graph": [ |
| 71 | + { |
| 72 | + "@type": "WebSite", |
| 73 | + "@id": "{{ site.url }}/#website", |
| 74 | + "url": "{{ site.url }}/", |
| 75 | + "name": "{{ site.title }}", |
| 76 | + "description": "{{ site.description | strip_html }}", |
| 77 | + "publisher": { |
| 78 | + "@type": "Organization", |
| 79 | + "@id": "{{ site.url }}/#organization" |
| 80 | + }, |
| 81 | + "potentialAction": [ |
| 82 | + { |
| 83 | + "@type": "SearchAction", |
| 84 | + "target": { |
| 85 | + "@type": "EntryPoint", |
| 86 | + "urlTemplate": "{{ site.url }}/search?q={search_term_string}" |
| 87 | + }, |
| 88 | + "query-input": "required name=search_term_string" |
| 89 | + } |
| 90 | + ] |
| 91 | + }, |
| 92 | + { |
| 93 | + "@type": "Organization", |
| 94 | + "@id": "{{ site.url }}/#organization", |
| 95 | + "name": "{{ site.title }}", |
| 96 | + "url": "{{ site.url }}/", |
| 97 | + "logo": { |
| 98 | + "@type": "ImageObject", |
| 99 | + "url": "{{ site.logo | absolute_url }}" |
| 100 | + }, |
| 101 | + "sameAs": [ |
| 102 | + "https://github.com/hmpl-language/hmpl", |
| 103 | + "https://x.com/hmpljs", |
| 104 | + "https://discord.gg/KFunMep36n" |
| 105 | + ] |
| 106 | + } |
| 107 | + {%- if page.layout == 'post' -%} |
| 108 | + ,{ |
| 109 | + "@type": "BlogPosting", |
| 110 | + "@id": "{{ page_url }}/#article", |
| 111 | + "isPartOf": { |
| 112 | + "@id": "{{ site.url }}/#website" |
| 113 | + }, |
| 114 | + "author": { |
| 115 | + "@type": "Person", |
| 116 | + "name": "{{ page.author | default: site.author.name }}" |
| 117 | + }, |
| 118 | + "headline": "{{ page.title }}", |
| 119 | + "datePublished": "{{ page.date | date_to_xmlschema }}", |
| 120 | + {%- if page.modified_date -%} |
| 121 | + "dateModified": "{{ page.modified_date | date_to_xmlschema }}", |
| 122 | + {%- else -%} |
| 123 | + "dateModified": "{{ page.date | date_to_xmlschema }}", |
| 124 | + {%- endif -%} |
| 125 | + "mainEntityOfPage": { |
| 126 | + "@type": "WebPage", |
| 127 | + "@id": "{{ page_url }}" |
| 128 | + }, |
| 129 | + "publisher": { |
| 130 | + "@type": "Organization", |
| 131 | + "@id": "{{ site.url }}/#organization" |
| 132 | + }, |
| 133 | + "image": { |
| 134 | + "@type": "ImageObject", |
| 135 | + "url": "{{ page_image }}" |
| 136 | + }, |
| 137 | + "description": "{{ page_description }}", |
| 138 | + "keywords": "{{ page_keywords }}", |
| 139 | + "articleSection": "{% if page.categories %}{{ page.categories | first }}{% else %}Technology{% endif %}", |
| 140 | + "inLanguage": "{{ site.lang | default: 'en-US' }}", |
| 141 | + "url": "{{ page_url }}" |
| 142 | + } |
| 143 | + {%- endif -%} |
| 144 | + {%- if page.layout == 'home' or page.url == '/' -%} |
| 145 | + ,{ |
| 146 | + "@type": "Blog", |
| 147 | + "@id": "{{ site.url }}/#blog", |
| 148 | + "mainEntityOfPage": { |
| 149 | + "@type": "WebPage", |
| 150 | + "@id": "{{ site.url }}/" |
| 151 | + }, |
| 152 | + "name": "{{ site.title }}", |
| 153 | + "description": "{{ site.description | strip_html }}", |
| 154 | + "publisher": { |
| 155 | + "@type": "Organization", |
| 156 | + "@id": "{{ site.url }}/#organization" |
| 157 | + }, |
| 158 | + "blogPost": [ |
| 159 | + {%- for post in site.posts limit: 10 -%} |
| 160 | + { |
| 161 | + "@type": "BlogPosting", |
| 162 | + "headline": "{{ post.title }}", |
| 163 | + "url": "{{ post.url | absolute_url }}", |
| 164 | + "datePublished": "{{ post.date | date_to_xmlschema }}", |
| 165 | + "author": { |
| 166 | + "@type": "Person", |
| 167 | + "name": "{{ post.author | default: site.author.name }}" |
| 168 | + } |
| 169 | + }{% unless forloop.last %},{% endunless %} |
| 170 | + {%- endfor -%} |
| 171 | + ] |
| 172 | + } |
| 173 | + {%- endif -%} |
| 174 | + ] |
| 175 | +} |
| 176 | +</script> |
| 177 | + |
| 178 | +<!-- Preconnect to external domains --> |
| 179 | +<link rel="preconnect" href="https://fonts.googleapis.com"> |
| 180 | +<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> |
| 181 | +<link rel="preconnect" href="https://unpkg.com"> |
| 182 | + |
| 183 | +<!-- Favicon and app icons --> |
| 184 | +<link rel="icon" href="/favicon.ico" type="image/x-icon"> |
| 185 | +<link rel="apple-touch-icon" href="/favicon.ico"> |
| 186 | + |
| 187 | +<!-- RSS Feed --> |
| 188 | +<link rel="alternate" type="application/rss+xml" title="{{ site.title }} Feed" href="{{ '/feed.xml' | absolute_url }}"> |
0 commit comments