Skip to content

Commit

Permalink
SEO enhancements + structured data
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Moffat authored and Mark Moffat committed Jan 23, 2020
1 parent 6141a41 commit 4ef5e48
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 2 deletions.
10 changes: 10 additions & 0 deletions config/baseSchema.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@
"type": "string",
"default": "£"
},
"currencyISO": {
"type": "string",
"default": "USD"
},
"paymentGateway": {
"type": "string",
"enum": ["paypal", "stripe", "authorizenet", "adyen", "instore"]
Expand Down Expand Up @@ -113,6 +117,12 @@
"maxQuantity": {
"type": "number"
},
"twitterHandle": {
"type": "string"
},
"facebookAppId": {
"type": "string"
},
"modules": {
"type": "object",
"properties": {
Expand Down
2 changes: 2 additions & 0 deletions config/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
"availableLanguages": ["en", "it"],
"defaultLocale": "en",
"maxQuantity": 25,
"twitterHandle": "",
"facebookAppId": "",
"modules": {
"enabled": {
"shipping": "shipping-basic",
Expand Down
36 changes: 34 additions & 2 deletions views/layouts/layout.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@
<link rel="canonical" href="{{config.baseUrl}}" />
{{/if}}
<meta name="referrer" content="origin" />
{{#if @root.config.facebookAppId}}
<meta property="fb:app_id" content="{{@root.config.facebookAppId}}" />
{{/if}}
<meta property="og:site_name" content="{{config.cartTitle}}" />
{{#if result.productTitle}}
<meta property="og:type" content="product" />
Expand All @@ -89,6 +92,9 @@
<meta property="og:description" content="{{snip config.cartDescription}}">
{{/if}}
{{/if}}
{{#if @root.config.twitterHandle}}
<meta property="twitter:site" content="{{@root.config.twitterHandle}}">
{{/if}}
{{#if result.productTitle}}
<meta property="twitter:card" content="product" />
{{else}}
Expand All @@ -102,12 +108,38 @@
{{/if}}
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "WebSite",
"@context": "https://schema.org/",
{{#if result.productTitle}}
"@type": "Product",
"name": "{{result.productTitle}}",
"offers": {
"price": "{{result.productPrice}}",
"priceCurrency": "{{config.currencyISO}}",
"description": "{{snip productDescription}}",
"sku": "{{result._id}}",
"url": "{{pageUrl}}"
},
{{else}}
"publisher": "{{config.cartTitle}}",
"@type": "WebSite",
{{/if}}
{{#if result.productImage}}
"image": "{{config.baseUrl}}{{result.productImage}}",
{{/if}}
{{#if productDescription}}
"description": "{{snip productDescription}}",
{{/if}}
{{#if result.productTitle}}
"sku": "{{result._id}}",
{{/if}}
{{#if pageUrl}}
"url": "{{pageUrl}}"
{{else}}
"url": "{{config.baseUrl}}"
{{/if}}
}
</script>

<!-- SEO data -->
{{~#if config.googleAnalytics}}{{{config.googleAnalytics}}}{{/if}}
{{~#if config.customCss}}<style>{{{config.customCss}}}</style>{{/if}}
Expand Down

0 comments on commit 4ef5e48

Please sign in to comment.