{% capture canonical_link %}{{ site.url }}{{ site.baseurl }}{{ page.url | replace:'index.html','' }}{% endcapture %} {% comment %} Canonical link for docs pages should point to the latest version of the page {% endcomment %} {% if page.version %} {% capture latest_url %}{{ page.url | replace_first: page.version, 'latest' }}{% endcapture %} {% if site.data.all-pages contains latest_url %} {% capture canonical_link %}{{ canonical_link | replace_first: page.version, 'latest' }}{% endcapture %} {% endif %} {% endif %} {% include analytics.html %}