aboutsummaryrefslogtreecommitdiff
path: root/_includes/seo.html
diff options
context:
space:
mode:
authorAndrew Lee <alee14498@gmail.com>2019-10-27 09:57:37 -0400
committerAndrew Lee <alee14498@gmail.com>2019-10-27 09:57:37 -0400
commite62e7bb6b14555c9bbe5d40d217103984f4f80e6 (patch)
tree21887d847dccacb47644eb6f74ce31326172303c /_includes/seo.html
parent716ea6ed2b64c921a799d872a07bfbd53b2a3e58 (diff)
downloadpokeworld-website-e62e7bb6b14555c9bbe5d40d217103984f4f80e6.tar.gz
pokeworld-website-e62e7bb6b14555c9bbe5d40d217103984f4f80e6.tar.bz2
pokeworld-website-e62e7bb6b14555c9bbe5d40d217103984f4f80e6.zip
Rewrite progress
Diffstat (limited to '_includes/seo.html')
-rw-r--r--_includes/seo.html161
1 files changed, 161 insertions, 0 deletions
diff --git a/_includes/seo.html b/_includes/seo.html
new file mode 100644
index 0000000..ead2d1f
--- /dev/null
+++ b/_includes/seo.html
@@ -0,0 +1,161 @@
+<!-- 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 -%}
+
+{%- assign author = page.author | default: page.authors[0] | default: site.author -%}
+{%- assign author = site.data.authors[author] | default: author -%}
+
+{%- if author.twitter -%}
+ {%- assign author_twitter = author.twitter | replace: "@", "" -%}
+{%- endif -%}
+
+{%- assign page_large_image = page.header.og_image | default: page.header.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 }}">
+<meta property="og:title" content="{{ page.title | default: site.title | markdownify | strip_html | strip_newlines | escape_once }}">
+<meta property="og:url" content="{{ canonical_url }}">
+
+{% if page.excerpt %}
+ <meta property="og:description" content="{{ seo_description }}">
+{% endif %}
+
+{% if page_large_image %}
+ <meta property="og:image" content="{{ page_large_image }}">
+{% elsif page_teaser_image %}
+ <meta property="og:image" content="{{ page_teaser_image }}">
+{% endif %}
+
+{% if site.twitter.username %}
+ <meta name="twitter:site" content="@{{ site.twitter.username | replace: "@", "" }}">
+ <meta name="twitter:title" content="{{ page.title | default: site.title | markdownify | strip_html | strip_newlines | escape_once }}">
+ <meta name="twitter:description" content="{{ seo_description }}">
+ <meta name="twitter:url" content="{{ canonical_url }}">
+
+ {% if page_large_image %}
+ <meta name="twitter:card" content="summary_large_image">
+ <meta name="twitter:image" content="{{ page_large_image }}">
+ {% else %}
+ <meta name="twitter:card" content="summary">
+ {% if page_teaser_image %}
+ <meta name="twitter:image" content="{{ page_teaser_image }}">
+ {% endif %}
+ {% endif %}
+
+ {% if author_twitter %}
+ <meta name="twitter:creator" content="@{{ author_twitter }}">
+ {% endif %}
+{% endif %}
+
+{% if page.date %}
+ <meta property="article:published_time" content="{{ page.date | date_to_xmlschema }}">
+{% endif %}
+
+{% if og_type == "article" and page.last_modified_at %}
+ <meta property="article:modified_time" content="{{ page.last_modified_at | date_to_xmlschema }}">
+{% endif %}
+
+{% if site.facebook %}
+ {% if site.facebook.publisher %}
+ <meta property="article:publisher" content="{{ site.facebook.publisher }}">
+ {% endif %}
+
+ {% if site.facebook.app_id %}
+ <meta property="fb:app_id" content="{{ site.facebook.app_id }}">
+ {% endif %}
+{% endif %}
+
+<link rel="canonical" href="{{ canonical_url }}">
+
+{% if paginator.previous_page %}
+ <link rel="prev" href="{{ paginator.previous_page_path | absolute_url }}">
+{% endif %}
+{% if paginator.next_page %}
+ <link rel="next" href="{{ paginator.next_page_path | absolute_url }}">
+{% endif %}
+
+<script type="application/ld+json">
+ {
+ "@context": "https://schema.org",
+ {% if site.social.type == "Organization" %}
+ "@type": "Organization",
+ "url": {{ '/' | absolute_url | jsonify }}{% if site.og_image %},
+ "logo": {{ site_og_image | jsonify }}{% endif %}
+ {% else %}
+ "@type": "Person",
+ "name": {{ site.social.name | default: site.name | jsonify }},
+ "url": {{ '/' | absolute_url |jsonify }}{% if site.social.links %},
+ "sameAs": {{ site.social.links | jsonify }}{% endif %}
+ {% endif %}
+ }
+</script>
+
+{% if site.google_site_verification %}
+ <meta name="google-site-verification" content="{{ site.google_site_verification }}" />
+{% endif %}
+{% if site.bing_site_verification %}
+ <meta name="msvalidate.01" content="{{ site.bing_site_verification }}">
+{% endif %}
+{% if site.alexa_site_verification %}
+ <meta name="alexaVerifyID" content="{{ site.alexa_site_verification }}">
+{% endif %}
+{% if site.yandex_site_verification %}
+ <meta name="yandex-verification" content="{{ site.yandex_site_verification }}">
+{% endif %}
+{% if site.naver_site_verification %}
+ <meta name="naver-site-verification" content="{{ site.naver_site_verification }}">
+{% endif %}
+<!-- end _includes/seo.html -->