Skip to content

Commit 7b193f4

Browse files
committed
seo fixes
1 parent 74d8acc commit 7b193f4

File tree

3 files changed

+41
-14
lines changed

3 files changed

+41
-14
lines changed

src/App.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,14 @@ export default {
6161
head() {
6262
return {
6363
title: 'Open Drinks',
64+
titleTemplate: '%s | Open Drinks',
6465
htmlAttrs: { lang: 'en' },
65-
meta: [{ name: 'description', content: 'Open Source Drink Recipes' }],
66+
meta: [
67+
{ name: 'description', content: 'Open Source Drink Recipes' },
68+
{ property: 'og:site_name', content: 'Open Drinks' },
69+
{ property: 'og:locale', content: 'en_US' },
70+
{ name: 'twitter:card', content: 'summary' },
71+
],
6672
};
6773
},
6874
};

src/components/Recipe.vue

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -209,22 +209,37 @@ export default {
209209
return 'Drink';
210210
};
211211
const imageUrl = this.drink.img ? `https://opendrinks.io${this.drink.img}` : undefined;
212+
const url = `https://opendrinks.io${window.location.pathname}`;
212213
return {
213214
title: metaTitle,
214-
titleTemplate: title => `${title} | Open Drinks`,
215-
htmlAttrs: { lang: 'en' },
215+
titleTemplate: '%s | Open Drinks',
216+
link: [{ rel: 'canonical', href: url }],
216217
meta: [
218+
// Basic SEO
217219
{ name: 'description', content: metaDescription },
220+
// Open Graph
218221
{ property: 'og:title', content: metaTitle },
219222
{ property: 'og:type', content: 'article' },
223+
{ property: 'og:url', content: url },
220224
{ property: 'og:site_name', content: 'Open Drinks' },
221-
{ property: 'og:url', content: `https://opendrinks.io${window.location.pathname}` },
225+
{ property: 'og:locale', content: 'en_US' },
222226
{ property: 'og:description', content: metaDescription },
223-
{ property: 'og:image', content: imageUrl },
224-
{ property: 'og:image:alt', content: this.drink.name },
225-
{ itemprop: 'name', content: this.drink.name },
226-
{ itemprop: 'description', content: metaDescription },
227-
{ itemprop: 'image', content: imageUrl },
227+
...(imageUrl
228+
? [
229+
{ property: 'og:image', content: imageUrl },
230+
{ property: 'og:image:alt', content: metaTitle },
231+
]
232+
: []),
233+
// Twitter / X
234+
{ name: 'twitter:card', content: 'summary_large_image' },
235+
{ name: 'twitter:title', content: metaTitle },
236+
{ name: 'twitter:description', content: metaDescription },
237+
...(imageUrl
238+
? [
239+
{ name: 'twitter:image', content: imageUrl },
240+
{ name: 'twitter:image:alt', content: metaTitle },
241+
]
242+
: []),
228243
],
229244
script: [
230245
{
@@ -233,7 +248,7 @@ export default {
233248
'@context': 'https://schema.org/',
234249
'@type': 'Recipe',
235250
name: this.drink.name,
236-
url: `https://opendrinks.io${window.location.pathname}`,
251+
url,
237252
description: metaDescription,
238253
image: imageUrl ? [imageUrl] : undefined,
239254
recipeIngredient,

src/views/ShotRecipes.vue

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,17 +116,23 @@ export default {
116116
const title = '50+ Best Shot Recipes (Easy Party & Bar Shots Guide)';
117117
const description =
118118
'Discover 50+ of the best shot recipes for parties and home bars. From sweet layered shots to strong classic shooters, find easy step-by-step recipes and ingredients.';
119+
const url = `https://opendrinks.io${window.location.pathname}`;
119120
return {
120121
title,
121-
titleTemplate: t => `${t} | Open Drinks`,
122-
htmlAttrs: { lang: 'en' },
122+
link: [{ rel: 'canonical', href: url }],
123123
meta: [
124+
// Basic SEO
124125
{ name: 'description', content: description },
126+
// Open Graph
125127
{ property: 'og:title', content: title },
126128
{ property: 'og:type', content: 'website' },
127-
{ property: 'og:site_name', content: 'Open Drinks' },
128-
{ property: 'og:url', content: `https://opendrinks.io${window.location.pathname}` },
129+
{ property: 'og:url', content: url },
130+
{ property: 'og:locale', content: 'en_US' },
129131
{ property: 'og:description', content: description },
132+
// Twitter / X
133+
{ name: 'twitter:card', content: 'summary_large_image' },
134+
{ name: 'twitter:title', content: title },
135+
{ name: 'twitter:description', content: description },
130136
],
131137
script: [
132138
{

0 commit comments

Comments
 (0)