Skip to content

Instantly share code, notes, and snippets.

@resistorsoftware
Created May 11, 2012 16:47
Show Gist options
  • Save resistorsoftware/2660898 to your computer and use it in GitHub Desktop.
Save resistorsoftware/2660898 to your computer and use it in GitHub Desktop.
Meta Tagger Blog SEO
{% if template contains 'blog' %}
{% assign mf = blog.metafields.meta_data %}
{% unless mf == empty %}
{% for mf in blog.metafields.meta_data %}
{% capture key %}{{ mf | first }}{% endcapture %}
{% if key == 'title' %}
<title>{{mf | last}}</title>
<meta name="title" content="{{mf | last}}" />
{% endif %}
{% if key == 'meta_description' %}
<meta name="description" content="{{mf | last}}" />
{% endif %}
{% if key == 'keywords' %}
<meta name="keywords" content="{{mf | last}}" />
{% endif %}
{% endfor %}
{% else %}
<title>{% if page_title != '' %}{{ page_title | escape }}{% else %}{{ blog.title }} {{ shop.name }}{% endif %}</title>
<meta name="description" content="{{ shop.name }} {{ blog.title | escape }} blog" />
{% endunless %}
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment