Activities

miteyema

miteyema posted a new bug report

sitemap-module •

bug sitemap conflicts with latest nuxt-i18n

Version

2.4.0

Reproduction link

https://github.com/miteyema/nuxt-i18n-demo

Steps to reproduce

What is expected ?

nuxt app builds successfully

What is actually happening?

nuxt app fails to build

Additional comments?

 ERROR  router.forEach is not a function                                                                                                          

  at flattenStaticRoutes (node_modules/@nuxtjs/sitemap/lib/routes.js:38:10)
  at getStaticRoutes (node_modules/@nuxtjs/sitemap/lib/routes.js:26:10)
  at Object.<anonymous> (node_modules/@nuxtjs/sitemap/lib/module.js:31:32)
  at Object.extendRoutes (node_modules/@nuxt/utils/dist/utils.js:1868:25)
  at Builder.resolveRoutes (node_modules/@nuxt/builder/dist/builder.js:5881:56)
  at async Promise.all (index 1)
  at async Builder.generateRoutesAndFiles (node_modules/@nuxt/builder/dist/builder.js:5710:5)
  at async Builder.build (node_modules/@nuxt/builder/dist/builder.js:5635:5)
  at async Object._buildDev (node_modules/@nuxt/cli/dist/cli-dev.js:106:5)
  at async Object.startDev (node_modules/@nuxt/cli/dist/cli-dev.js:64:7)
  at async Object.run (node_modules/@nuxt/cli/dist/cli-dev.js:51:5)
  at async NuxtCommand.run (node_modules/@nuxt/cli/dist/cli-index.js:2810:7)
TooColline

TooColline posted a new question

sitemap-module •

/sitemap.xml not generating on production

The sitemap.xml is not being generated on production.

When I go to my site e.g. https://mysite.com/sitemap.xml I get a 404 yet on my dev environment I can see it's generated well. Is there something I am missing?

Steps I used:

modules: ['@nuxtjs/sitemap'],
sitemap: {
    hostname: process.env.BASE_URL || 'http://localhost:3000',
    defaults: {
      lastmod: new Date(),
      changefreq: 'weekly',
      priority: 1
    }
  }

On my localhost:3000/sitemap.xml I can see the sitemap
On production e.g. https://mysite.com/sitemap.xml I get a 404

dseeker

dseeker posted a new question

sitemap-module •

How to add XML attribute currency to <video:price>

Is there a special JSON object or way to add XML attributes to tags?

I'm trying to create a sitemap with video objects for google adding <video:price>, but search console is returning error for missing currency attribute
this is what they require

<video:price currency="EUR">1.99</video:price>

How can this be generated from the javascript object?

sv1226

sv1226 posted a new question

sitemap-module •

Sitemap module not updating with updates in articles, it is generated one time during the build process

I am facing a problem while using nuxt sitemaps
I have added dynamic links to the sitemaps using axios. it is working perfectly one time after build process but when new articles are added by the backend, sitemaps not get updated. it i showing the same file again and again. I have tried with cacheTime also but that also didn't work. Please help me to find any solution to this

sterzuccio

sterzuccio posted a new question

sitemap-module •

How to set dynamic priority and lastmod when using axios

Hi,
i've succesfully created the sitemap using dynamic routes with axios but i'm unable to set dynamic params inside the map function:

routes: () => {
return axios.get('http://localhost:1337'+'/pages').then(res => {
return res.data.map(
page => ({
route: '/'+page.lang.slug+'/'+page.slug,
changefreq: 'monthly',
priority: 1,
lastmod: new Date()
})
);
})
}

Sitemap was generated without errors but only the loc tag is present.

altynbek07

altynbek07 posted a new bug report

sitemap-module •

bug Nuxt 2.13.3 Uncaught TypeError: Cannot use 'in' operator to search for

Version

v2.4.0

Reproduction link

https://github.com/nuxt-community/sitemap-module

Steps to reproduce

Hi. I installed a fresh clean version of Nuxt 2.13.3 with these options:

npx create-nuxt-app project-nuxt

Project name: project-nuxt
Programming language: JavaScript
Package manager: Npm
UI framework: None
Nuxt.js modules: Axios
Linting tools: ESLint, Prettier
Testing framework: None
Rendering mode: Universal (SSR / SSG)
Deployment target: Server (Node.js hosting)
Development tools: None

Then I install sitemap module: npm install @nuxtjs/sitemap. And added @nuxtjs/sitemap in my nuxt.config.js (without any options, just default):

modules: [
  '@nuxtjs/sitemap',
]

What is expected ?

Without any errors.

What is actually happening?

After going to http://localhost:3000 I got 3 errors (attached screenshots):

Uncaught TypeError: Cannot use 'in' operator to search for 'WebkitAppearance' in undefined
Uncaught TypeError: Cannot use 'in' operator to search for 'animation' in undefined
Uncaught TypeError: Cannot read property 'charAt' of undefined

localhost:55888:sitemap.xml 2020-07-17 18-57-38.png

SimonFricker

SimonFricker posted a new feature request

sitemap-module •

idea Use ENV variables with Nuxt 2.13.x (nuxt static export)

What problem does this feature solve?

I am using Nuxt 2.13.3 to develop in universal mode and export it as a static site.

I am using dotenv to get some enviroment variables and it would be great to use it in conjunction with the sitemap module.

Currently I receive the following error:

[sitemap-module] The `hostname` option is mandatory in your config on `spa` or `generate` build mode

What does the proposed changes look like?

require('dotenv').config()

export default {
  mode: 'universal',
  target: 'static',

  generate: {
    fallback: true
  },

  env: {
    baseUrl: process.env.BASE_URL || 'http://localhost:3000'
  },

  sitemap() {
    return {
      hostname: process.env.baseUrl,
    }
  },
}
altynbek07

altynbek07 posted a new bug report

sitemap-module •

bug Disable i18n

Version

v2.4.0

Reproduction link

https://github.com/nuxt-community/sitemap-module

Steps to reproduce

Add i18n
Add sitemap
Configure both according to doc

What is expected ?

I want to disable autogenerated i18n routes in sitemap. In my nuxt.config.js I setted i18n: false option in sitemap section:

// nuxt.config.js

{
  modules: [
    ['nuxt-i18n', {
      locales: [
          { code: 'ru', name: "Русский", file: 'ru.js', iso: 'ru-RU' },
          { code: 'kk', name: "Қазақша", file: 'kk.js', iso: 'kk-KZ' },
          { code: 'en', name: "English", file: 'en.js', iso: 'en-US' }
      ],
      defaultLocale: 'ru',
      // and some other i18n options
    }],
    ['@nuxtjs/sitemap', {
      // some other  sitemap options
      i18n: false
    }]
  ]
}

What is actually happening?

Sitemap still generated with i18n routes

bpeab

bpeab posted a new question

sitemap-module •

Follow noindex, nofollow

Hello,

I wonder if there's any way so that I can filter the routes and remove the ones where the robots meta tags is set with noindex,nofollow. I tried with the filter property but apparently the routes are not providing the meta object and therefore I don't see anyway I could do that.

Thanks for the help !

rutgerbakker95

rutgerbakker95 posted a new feature request

sitemap-module •

idea Nuxt 2.13.0 compatibility (nuxt static export)

What problem does this feature solve?

It would be nice if the sitemap automatically generate routes in combination with the Nuxt static option

ems1985

ems1985 posted a new bug report

sitemap-module •

bug i18n option only generates <url> for default language

Version

2.3.2

Reproduction link

https://github.com/nuxt-community/sitemap-module/blob/dev/README.md

Steps to reproduce

(Please note that the reproduction link, is just as a link to the docs, because the problem is already shown in the i18n docs example.)

When using the i18n option to generate a sitemap, only one <url> is generated for all language versions. But, according to a Google post (https://support.google.com/webmasters/answer/189077) there should be a <url> created for every page. I know it seems redundant, but I guess thats how it should be.

What is expected ?

 <url>
    <loc>https://example.com/</loc>
    <xhtml:link rel="alternate" hreflang="en" href="https://example.com/"/>
    <xhtml:link rel="alternate" hreflang="es" href="https://example.com/es/"/>
  </url>
 <url>
    <loc>https://example.com/es/</loc>
    <xhtml:link rel="alternate" hreflang="en" href="https://example.com/"/>
    <xhtml:link rel="alternate" hreflang="es" href="https://example.com/es/"/>
  </url>

What is actually happening?

 <url>
    <loc>https://example.com/</loc>
    <xhtml:link rel="alternate" hreflang="en" href="https://example.com/"/>
    <xhtml:link rel="alternate" hreflang="es" href="https://example.com/es/"/>
  </url>
simplenotezy

simplenotezy posted a new bug report

sitemap-module •

bug i18n rel-alternate-hreflang missing for generated routes

Version

2.3.1

Reproduction link

https://thejewelleryroom.com/sitemap.xml

Steps to reproduce

1) Set sitemap configuration like so:

    sitemap: {
        hostname: process.env.BASE_URL,
        gzip: true,
        i18n: {
            defaultLocale: 'en',
            locales: ['en', 'da'],
            routesNameSeparator: '___'
        },

2) Generate the sitemap

3) Inspect the sitemap.xml

What is expected ?

<url><loc>https://thejewelleryroom.com/product/product-name</loc><lastmod>2020-06-14T20:01:44.123Z</lastmod><changefreq>daily</changefreq><priority>1.0</priority> <xhtml:link rel="alternate" hreflang="da" href="https://thejewelleryroom.com/da/produkt/product-name"/> foreach of the different routes</url>

What is actually happening?

<url><loc>https://thejewelleryroom.com/da/produkt/product-name</loc><lastmod>2020-06-14T20:01:44.123Z</lastmod><changefreq>daily</changefreq><priority>1.0</priority></url>

Additional comments?

I'm not sure what I am missing or doing wrong; I believe I've done everything according to the documentation. Sitemap may be viewed here: https://thejewelleryroom.com/sitemap.xml

brumartins

brumartins posted a new bug report

sitemap-module •

bug i18n rel-alternate-hreflang on a website with a base url

Version

2.3.1

Reproduction link

https://github.com/brumartins/nuxt-wiki

Steps to reproduce

Hello! 😃

I'm trying to use the i18n feature to build a multilingual sitemap, and I'm not getting exactly what I would expect. I'm not sure if I'm missing something in the sitemap-module configuration or if it is a bug.

My Nuxt app is hosted on Github Pages and contains a base url /nuxt-wiki (http://brumartins.github.io/nuxt-wiki). The routes in the <loc> tags are correct, but the alternate links are missing the base url.

Here are the steps to generate the sitemap :

$ npm install

# generate static project (for deployment on Github Pages)
# select first command if using Windows, otherwise select the 2nd one
$ npm run generate:gh-pages-win 
$ npm run generate:gh-pages

Open the dist/sitemap.xml file. The sitemap is great, the translated alternate links are taken into account, but the base url is missing for these alternate links.

What is expected ?

I'd expect a sitemap with

<url>
    <loc>http://brumartins.github.io/nuxt-wiki/</loc>
    <xhtml:link rel="alternate" hreflang="fr" href="http://brumartins.github.io/nuxt-wiki/fr"/>
    <xhtml:link rel="alternate" hreflang="en" href="http://brumartins.github.io/nuxt-wiki"/>
</url>

What is actually happening?

But I get this (nuxt-wiki base url is missing on alternate links)

<url>
    <loc>http://brumartins.github.io/nuxt-wiki/</loc>
    <xhtml:link rel="alternate" hreflang="fr" href="http://brumartins.github.io/fr"/>
    <xhtml:link rel="alternate" hreflang="en" href="http://brumartins.github.io/"/>
</url>

Additional comments?

Here is the nuxt configuration (link to full file)

const HOSTNAME = process.env.DEPLOY_ENV === 'GH_PAGES' ? 'http://brumartins.github.io' : 'http://localhost:3000';

export default {
  /* ... */
  sitemap: {
    hostname: HOSTNAME,
    gzip: true,
    i18n: 'en'
  }
}

I tried to add the base url to hostname property in the nuxt.config.js file. The path in the <loc> tag became http://brumartins.github.io/nuxt-wiki/nuxt-wiki/ and nothing changed for the alternate links.

Thank you in advance for your time 😊

simplenotezy

simplenotezy posted a new question

sitemap-module •

Sitemap looks weird

Is sitemap supposed to look like this?

Screenshot 2020-06-13 at 22.41.51.png

It looks kinda weird.

tegola

tegola posted a new question

sitemap-module •

How do I invalidate the cache?

I'm trying to build a sitemap index consisting of a static one (the default one generated by the module) and a dynamic one for each country of the venue list on the db.

However, no matter how much I try or set cacheTime to 0, I can't see the dynamic route list reloading.

Even with the test configuration below, which will should generate a new /test/<timestamp> everytime the /sitemap-test.xml url is requested, the timestamp never changes, and the console only shows 'adding test route' once.

// nuxt.config.js
{
    sitemap() {
        const sitemaps = []

        // Main, escluding /user and /<lang>/user
        sitemaps.push({
            path: '/sitemap-main.xml',
            cacheTime: 0,
            filter({ routes }) {
                return routes.filter(route => !route.path.match(/^(\/[a-z]{2})?\/user/i))
            }
        })

        sitemaps.push({
            path: '/sitemap-test.xml',
            cacheTime: 0,
            exclude: ['/**'],
            routes: () => {
                console.log('adding test route')
                const t = new Date().getTime()

                return [`/test/${t}`]
            }
        })

        return {
            path: '/sitemap.xml',
            sitemaps
        }
    }
}

Is this normal? Am I doing something wrong? I'm not using nuxt generate, just nuxt dev, or nuxt build && nuxt start.

simplenotezy

simplenotezy posted a new feature request

sitemap-module •

idea Support routes from "generate.routes" output

What problem does this feature solve?

Ease-of-use. Would be cool if it generated sitemap on deploy from output already fetched here in my nuxt.config.js generate.routes property, with exception of the "payload" data, so I don't have to repeat my code, and take extra unnessecary resources on the deploy server.

What does the proposed changes look like?

Somehow fetch the generate.routes output and remove payload property and generate sitemap based on this.

hoiheart

hoiheart posted a new feature request

sitemap-module •

idea The hreflang value is not ISO based when used with i18n

What problem does this feature solve?

The hreflang produced by nuxt-i18n is based on the iso attribute.
But sitemap does not produce hreflang based on the iso attribute.
I want to be provided with a hook function or a method of using iso property base.

lautr

lautr posted a new feature request

sitemap-module •

idea allow option to disable usage of publicPath

What problem does this feature solve?

The usage of base.publicPath to use as the host for the sitemap does not make sense when it's also used to set up the CDN for Nuxt Assets, which is its recommended usage.

Therefore it would make sense to disable this feature to allow nuxt/sitemap to regularly decide it's host, or provide a way to access the request to set host manually.

Right now the host name needs to be hard coded which makes it's usage hard for multi domain deployments and tests in feature environments.

BerciTheBeast

BerciTheBeast posted a new feature request

sitemap-module •

idea Enable hostname prepend for video thumbnails

What problem does this feature solve?

Video thumbnail_loc properties are currently not being prepended with hostnames if the URL is not valid.

What does the proposed changes look like?

If the thumbnail_loc is not a valid URL it would be prepended with the hostname, similar to image URLs. It would be nice if this option was toggleable in the config or even per video entry.

BerciTheBeast

BerciTheBeast posted a new feature request

sitemap-module •

idea Enable alias resolution for paths

What problem does this feature solve?

Currently, if you provide an alias in an image path, like @ or ~, the alias is not resolved and carried over to the sitemap xml.

What does the proposed changes look like?

Aliases inside urls and possibly other parameters would resolve to their actual paths.