Skip to content

Commit

Permalink
fix: Disable seo by default
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Global seo option is now disabled by default. To
preserve the previous behaviour, set `seo: true` in the module's
options.
Doc: https://nuxt-community.github.io/nuxt-i18n/seo.html

fixes #346
  • Loading branch information
rchl authored and paulgv committed Jul 15, 2019
1 parent c1f51f1 commit 5115b5b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
8 changes: 5 additions & 3 deletions docs/options-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,11 @@ Here are all the options available when configuring the module and their default
// HTTP header instead of window.location
forwardedHost: false,

// If true, SEO metadata is generated for routes that have i18n enabled
// Set to false to disable app-wide
seo: true,
// If true, SEO metadata is generated for routes that have i18n enabled.
// Note that performance can suffer with this enabled and there might be compatibility
// issues with some plugins. Recommended way is to set up SEO as described in:
// https://nuxt-community.github.io/nuxt-i18n/seo.html#improving-performance
seo: false,

// Base URL to use as prefix for alternate URLs in hreflang tags
baseUrl: '',
Expand Down
10 changes: 5 additions & 5 deletions docs/seo.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# SEO

By default, **nuxt-i18n** attempts to add some metadata to improve your pages SEO. Here's what it does:
With `seo` option enabled, **nuxt-i18n** attempts to add some metadata to improve your pages SEO. Here's what it does:

* Add a _lang_ attribute containing current locale's ISO code to the `<html>` tag.
* Generate `<link rel="alternate" hreflang="x">` tags for every language configured in `nuxt.config.js`. For each language, the ISO code is used as `hreflang` attribute's value. [More on hreflang](https://support.google.com/webmasters/answer/189077)
* Generate `og:locale` and `og:locale:alternate` meta tags as defined in the [Open Graph protocol](http://ogp.me/#optional)
* When using `prefix_and_default` strategy, generate `rel="canonical"` link on the default language routes containing the
* When using `prefix_and_default` strategy, generate `rel="canonical"` link on the default language routes containing the
prefix to avoid duplicate indexation. [More on canonical](https://support.google.com/webmasters/answer/182192#dup-content)


Expand Down Expand Up @@ -43,13 +43,13 @@ You should also set the `baseUrl` option to your production domain in order to m
```


To disable this feature everywhere in your app, set `seo` option to `false`:
To enable this feature everywhere in your app, set `seo` option to `true`:

```js
// nuxt.config.js

['nuxt-i18n', {
seo: false
seo: true
}]
```

Expand All @@ -76,7 +76,7 @@ This means each time a component is created, the SEO metadata is recomputed for
To improve performance you can use the `$nuxtI18nSeo` method in your layout instead.
It will generate i18n SEO metadata for the current context.

First you need to disable automatic SEO by setting `seo` to `false` in your configuration:
First make sure automatic SEO is disabled by setting `seo` to `false` in your configuration or removing that option completely:

```js
// nuxt.config.js
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ exports.DEFAULT_OPTIONS = {
},
differentDomains: false,
forwardedHost: false,
seo: true,
seo: false,
baseUrl: '',
vuex: {
moduleName: 'i18n',
Expand Down
2 changes: 1 addition & 1 deletion types/vue.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ declare namespace NuxtVueI18n {
langDir: string | null
rootRedirect: string | null
detectBrowserLanguage: Options.DetectBrowserLanguageInterface
seo: false
seo: boolean
baseUrl: string
vuex: Options.Vuex
parsePages: boolean
Expand Down

0 comments on commit 5115b5b

Please sign in to comment.