{% comment %}

This partial assigns these variables:

    meta_image: "https://assets.devhints.io/previews/react.jpg"
    meta_description: "A comprehensive cheatsheet for React."
    meta_title: "React cheatsheet"
    depth: "1"
    base: "./"
    timestamp: "293048189123"
    page_url: "https://devhints.io/react"

It emits some blank lines because Jekyll, lol.

{% endcomment %}

{% assign depth = page.url | split: '/' | size | minus: 1 %}

{% assign base = '' %}
{% if depth <= 1 %}{% assign base = '.' %}
{% elsif depth == 2 %}{% assign base = '..' %}
{% elsif depth == 3 %}{% assign base = '../..' %}
{% elsif depth == 4 %}{% assign base = '../../..' %}{% endif %}

{% assign timestamp = site.time | date: "%Y%m%d%H%M%S" %}

{% if site.data.assets.preview_host %}{% capture meta_image %}{%
  if page.url == '/'
%}{{ site.data.assets.preview_host }}/index.jpg?t={{ timestamp }}{%
  else
%}{{ site.data.assets.preview_host }}{{ include.page.url | remove: '.html' }}.jpg?t={{ timestamp }}{%
  endif
%}{% endcapture %}{% endif %}

{% capture meta_title %}{% include values/title.html page=include.page %}{% endcapture %}
{% assign meta_title = meta_title | strip_newlines %}

{% capture meta_description %}{% include values/description.html page=include.page %}{% endcapture %}
{% assign meta_description = meta_description | strip_newlines %}

{% capture page_url %}{{ site.url }}{{ page.url | remove: '.html' }}{% endcapture %}
