nuxt-i18n
Advanced tools
Comparing version 2.9.5 to 2.10.0
@@ -5,2 +5,12 @@ # Change Log | ||
<a name="2.10.0"></a> | ||
# [2.10.0](https://github.com/nuxt-community/nuxt-i18n/compare/v2.9.5...v2.10.0) (2018-04-30) | ||
### Features | ||
* **seo:** Add og:locale tags ([a688b6a](https://github.com/nuxt-community/nuxt-i18n/commit/a688b6a)) | ||
<a name="2.9.5"></a> | ||
@@ -7,0 +17,0 @@ ## [2.9.5](https://github.com/nuxt-community/nuxt-i18n/compare/v2.9.4...v2.9.5) (2018-04-18) |
@@ -5,23 +5,35 @@ import Vue from 'vue' | ||
head () { | ||
if (this.$i18n && this.$i18n.ignorePaths.indexOf(this.$route.fullPath) === -1) { | ||
// Prepare html lang attribute | ||
const currentLocaleData = this.$i18n.locales.find(l => l.code === this.$i18n.locale) | ||
const htmlAttrs = {} | ||
if (currentLocaleData && currentLocaleData.iso) { | ||
htmlAttrs.lang = currentLocaleData.iso | ||
} | ||
return { | ||
htmlAttrs, | ||
// Generate hreflang tags | ||
link: this.$i18n.locales.map(locale => ({ | ||
hid: 'alternate-hreflang-' + locale.iso, | ||
rel: 'alternate', | ||
href: this.switchLocalePath(locale.code), | ||
hreflang: locale.iso | ||
})) | ||
} | ||
if (!this.$i18n || this.$i18n.ignorePaths.indexOf(this.$route.fullPath) !== -1) { | ||
return {} | ||
} | ||
return {} | ||
// Prepare html lang attribute | ||
const currentLocaleData = this.$i18n.locales.find(l => l.code === this.$i18n.locale) | ||
const htmlAttrs = {} | ||
if (currentLocaleData && currentLocaleData.iso) { | ||
htmlAttrs.lang = currentLocaleData.iso | ||
} | ||
return { | ||
htmlAttrs, | ||
// Generate hreflang tags | ||
link: this.$i18n.locales.map(locale => ({ | ||
hid: 'alternate-hreflang-' + locale.iso, | ||
rel: 'alternate', | ||
href: this.switchLocalePath(locale.code), | ||
hreflang: locale.iso | ||
})), | ||
meta: [ | ||
// Replace dash with underscore as defined in spec: language_TERRITORY | ||
{ hid: 'og:locale', name: 'og:locale', property: 'og:locale', content: currentLocaleData.iso.replace(/-/g, '_') }, | ||
...this.$i18n.locales | ||
.filter(l => l.iso !== currentLocaleData.iso) | ||
.map(locale => ({ | ||
hid: 'og:locale:alternate-' + locale.iso, | ||
name: 'og:locale:alternate', | ||
property: 'og:locale:alternate', | ||
content: locale.iso.replace(/-/g, '_') | ||
})) | ||
] | ||
} | ||
} | ||
}) | ||
{ | ||
"name": "nuxt-i18n", | ||
"version": "2.9.5", | ||
"version": "2.10.0", | ||
"description": "i18n for Nuxt", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
28964
428