You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
'Contact FooBarAgency with the online form or reach us in our office at 766 Parkway Street, Los Angeles, California.';
102
+
"Contact FooBarAgency with the online form or reach us in our office at 766 Parkway Street, Los Angeles, California.";
103
103
104
104
exportdefault {
105
-
name: 'ContactPage',
105
+
name: "ContactPage",
106
106
mixins: [PageMetaMixin(title, description)],
107
107
data() {
108
-
...
109
-
}
110
-
}
108
+
//...
109
+
},
110
+
};
111
111
```
112
112
113
113
`` title => `${title} - FooBarAgency` `` argument is useful to add a prefix/suffix to nested pages own title, but if no transformation is needed just leave it blank:
114
114
115
115
```ts
116
116
exportdefault {
117
-
name: 'MainLayout',
117
+
name: "MainLayout",
118
118
mixins: [LayoutMetaMixin()], // <-- no argument here
119
119
data() {
120
-
...
121
-
}
122
-
}
120
+
//...
121
+
},
122
+
};
123
123
```
124
124
125
125
This AE sets `og:url` and `og:image` based on the domain provided into `process.env.APP_DOMAIN` (read more about [process.env](https://quasar.dev/quasar-cli/handling-process-env#Adding-to-process.env)).
@@ -162,6 +162,58 @@ export default {
162
162
163
163
`metaTag` accepts the meta tag name, or an array of names, as first parameter and the value as second parameter.
164
164
165
+
## Dynamic support for i18n
166
+
167
+
Be sure to understand how [App Internationalization (i18n)](https://quasar.dev/options/app-internationalization#Introduction) and [Custom directive localization](http://kazupon.github.io/vue-i18n/guide/directive.html#string-syntax) work before proceeding.
168
+
This mixin assumes [`vue-i18n`](https://github.com/kazupon/vue-i18n) has already been set up in your project.
169
+
170
+
`PageMetaMixin` is perfect until you add internationalization to the mix, which requires to dynamically update you tags and meta tags accordingly to the selected language: `PageMetaI18nMixin` address this use case.
171
+
172
+
### Using `PageMetaI18nMixin`
173
+
174
+
You use `PageMetaI18nMixin` exactly how you would use `PageMetaMixin`, except you provide "translation paths" as arguments instead of the text itself.
175
+
The mixin automatically react to `$root.$i18n.locale` changes, updating meta tags accordingly.
176
+
177
+
```ts
178
+
// src/i18n/it/contacts.ts <-- Notice these are the website italian translations
179
+
180
+
exportdefault {
181
+
meta: {
182
+
title: "Contatti",
183
+
description:
184
+
"Contatta FooBarAgency con il nostro modulo online o raggiungici in ufficio a Parkway Street 766, Los Angeles, California.",
0 commit comments