Optional Google Analytics, Google Authorship, webmaster verifies, and Twitter cards meta.

This commit is contained in:
Michael Rose 2013-07-17 08:57:09 -04:00
parent 17f6e0c599
commit a4bcd6e0a9
2 changed files with 9 additions and 7 deletions

View file

@ -2,7 +2,7 @@
<title>{% if page.title %}{{ page.title }} &#8211; {% endif %}{{ site.title }}</title>
<meta name="description" content="{{ page.description }}">
<meta name="keywords" content="{{ page.tags | join: ', ' }}">
<!-- Twitter Card and Open Graph meta -->
{% if site.owner.twitter %}<!-- Twitter Card and Open Graph meta -->
<meta name="twitter:title" content="{% if page.title %}{{ page.title }} &#8211; {% endif %}{{ site.title }}">
<meta name="twitter:description" content="{% if page.description %}{{ page.description }}{% else %}{{ page.content | strip_html | strip_newlines | truncate: 120 }}{% endif %}">
<meta name="twitter:creator" content="@{{ site.owner.twitter }}">
@ -11,7 +11,7 @@
{% if page.image %}<meta name="twitter:image:src" content="{{ site.url }}/images/{{ page.image.feature }}">{% endif %}
{% else %}
<meta name="twitter:card" content="summary">
<meta name="twitter:image:src" content="{% if page.image.thumb %}{{ site.url }}/images/{{ page.image.thumb }}{% else %}{{ site.url }}/images/default-thumb.png{% endif %}">
<meta name="twitter:image:src" content="{% if page.image.thumb %}{{ site.url }}/images/{{ page.image.thumb }}{% else %}{{ site.url }}/images/default-thumb.png{% endif %}">{% endif %}
<meta property="og:type" content="article">
<meta property="og:image" content="{% if page.image.thumb %}{{ site.url }}/images/{{ page.image.thumb }}{% else %}{{ site.url }}/images/default-thumb.png{% endif %}">
{% endif %}
@ -21,14 +21,14 @@
<meta property="og:url" content="{{ site.url }}{{ page.url }}">
<meta property="og:site_name" content="{{ site.title }}">
<!-- Webmaster Tools verfication -->
<meta name="google-site-verification" content="{{ site.google_verify }}">
<meta name="msvalidate.01" content="{{ site.bing_verify }}">
{% if site.google_verify %}<!-- Webmaster Tools verfication -->
<meta name="google-site-verification" content="{{ site.google_verify }}">{% endif %}
{% if site.bing_verify %}<meta name="msvalidate.01" content="{{ site.bing_verify }}">{% endif %}
{% capture canonical %}{{ site.url }}{% if site.permalink contains '.html' %}{{ page.url }}{% else %}{{ page.url | remove:'index.html' | strip_slash }}{% endif %}{% endcapture %}
<link rel="canonical" href="{{ canonical }}">
<link href="{{ site.url }}/feed.xml" type="application/atom+xml" rel="alternate" title="{{ site.title }} Feed">
<link rel="author" href="{{ site.owner.google_plus }}?rel=author">
{% if site.owner.google_plus %}<link rel="author" href="{{ site.owner.google_plus }}?rel=author">{% endif %}
<!-- http://t.co/dKP3o1e -->
<meta name="HandheldFriendly" content="True">

View file

@ -1,6 +1,7 @@
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="{{ site.url }}/assets/js/vendor/jquery-1.9.1.min.js"><\/script>')</script>
<script src="{{ site.url }}/assets/js/main.min.js"></script>
{% if site.google_analytics %}
<!-- Asynchronous Google Analytics snippet -->
<script>
var _gaq = _gaq || [];
@ -15,4 +16,5 @@
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</script>
{% endif %}