Skip to content

Commit

Permalink
Adds auto generated robots.txt
Browse files Browse the repository at this point in the history
Related to Issues #25
  • Loading branch information
BobChao87 committed Jul 28, 2021
1 parent 787aa79 commit e5293ae
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
17 changes: 17 additions & 0 deletions nuxt.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

const locales = [
{ code: 'ca', iso: 'ca', file: 'ca.json' },
{ code: 'cy', iso: 'cy', file: 'cy.json' },
Expand Down Expand Up @@ -62,6 +63,7 @@ export default {
'modules': [
'@nuxt/http',
'@nuxtjs/google-gtag',
'@nuxtjs/robots',
'nuxt-i18n',
'nuxt-ssr-cache',
// sitemap should always come last
Expand Down Expand Up @@ -101,6 +103,20 @@ export default {
],
},

// robots configuration: https://github.com/nuxt-community/robots-module
// Provides an automated /robots.txt
'robots': {
UserAgent: '*',
Disallow: [
'login/',
// Disallow both the page and directory
'user/settings',
'user/settings/',
].reduce((rules, page) => rules.concat(locales.map(locale => `/${locale.code}/${page}`)), []),
// TODO Should be a dynamically bound URL to be fed through ENV
Sitemap: 'https://v2.oengus.dev/sitemap.xml',
},

// i18n configuration: https://i18n.nuxtjs.org/
'i18n': {
locales,
Expand Down Expand Up @@ -147,6 +163,7 @@ export default {
},

// Sitemap configuration: https://sitemap.nuxtjs.org/
// Provides an automated /sitemap.xml
'sitemap': {
hostname: 'https://v2.oengus.dev',
i18n: {
Expand Down
5 changes: 5 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"dependencies": {
"@nuxt/http": "^0.6.4",
"@nuxtjs/google-gtag": "^1.0.4",
"@nuxtjs/robots": "^2.5.0",
"@nuxtjs/sitemap": "^2.4.0",
"core-js": "^3.15.2",
"nuxt": "^2.15.7",
Expand Down

0 comments on commit e5293ae

Please sign in to comment.