Skip to content

Instantly share code, notes, and snippets.

@allusis
Created February 22, 2017 02:12
Show Gist options
  • Save allusis/bdccdd9a139414fa4365a58300f9fd54 to your computer and use it in GitHub Desktop.
Save allusis/bdccdd9a139414fa4365a58300f9fd54 to your computer and use it in GitHub Desktop.
Statamic Meta, OG, and Schema in Segments
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="{{ site_description }}">
{{ if segment_1 == "products" }}
<title>{{ title ensure_right=" / " }}{{ site_name }}</title>
{{ else }}
<title>{{ title }}</title>
{{ /if }}
<link rel="stylesheet" href="{{ theme:css }}">
<meta property="og:type" content="website" />
{{ if segment_1 == "products" }}
<meta property="og:title" content="{{ title }} - {{ site_name }}" />
<meta property="og:url" content="{{ url ensure_left="http://affordableappliance.services" }}" />
<meta property="og:description" content="{{ description }}" />
{{ if featured_image }}
<meta property="og:image" content="{{ assets:featured_image }}{{ url ensure_left="http://affordableappliance.services" }}{{ /assets:featured_image }}" />
{{ else }}
<meta property="og:image" content="{{ glide width="600" height="315" fit="crop" }}{{ theme:img src="facebook_card.png" }}{{ /glide}}" />
{{ /if }}
{{ else }}
<meta property="og:title" content="{{ title }}" />
<meta property="og:url" content="{{ site_url }}" />
<meta property="og:description" content="{{ site_description }}" />
<meta property="og:image" content="http://affordableappliance.services{{ theme:img src="facebook_card.png" }}" />
{{ /if }}
<script type="application/ld+json">
{
"@context" : "http://schema.org",
"@type" : "ShoppingCenter",
"address" : {
"@type": "PostalAddress",
"addressLocality": "{{ city }}",
"addressRegion": "New York",
"postalCode": "{{ postal_code }}",
"streetAddress": "{{ street_address }}" },
"name":"{{ site_name }}",
"url":"affordableappliance.services",
"email":"[email protected]",
"telephone":"{{ telephone }}",
"openingHours": [
{{ hours_of_operation }}{{ if day == last }}"{{ title }}: {{ if closed == "true" }}Closed{{ else }}{{ open_time format="g:iA"}} - {{ close_time format="g:i a"}}{{ /if }}",{{ /if }}{{ if last }}"{{ title }}: {{ if closed == "true" }}Closed{{ else }}{{ open_time format="g:i a"}} - {{ close_time format="g:i a"}}{{ /if }}"{{ /if }}{{ /hours_of_operation }}
]
}
</script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', '{{ google_analytics_id }}', 'auto');
ga('send', 'pageview');
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment