Activities

sts-ryan-holton

sts-ryan-holton posted a new bug report

sitemap-module •

bug URLs generated in sitemap despite exclusion

Version

2.4.0

Reproduction link

https://example.com/

Steps to reproduce

See attached nuxt.config.js as I suspect something might be wrong here?

require('dotenv').config();
import axios from 'axios'
import getRoutes from './utils/getRoutes'

export default {
  /*
  ** Nuxt rendering mode
  ** See https://nuxtjs.org/api/configuration-mode
  */
  mode: 'universal',
  /*
  ** Nuxt target
  ** See https://nuxtjs.org/api/configuration-target
  */
  target: 'static',
  /*
  ** Env variables
  */
  env: {
    BASE_URL: process.env.BASE_URL || "https://domain-monitor.io",
    API_URL: process.env.API_URL || "http://127.0.0.1:8000",
    ONESIGNAL_PUSH_APP_ID: process.env.ONESIGNAL_PUSH_APP_ID || "",
    ONESIGNAL_SAFARI_WEB_ID: process.env.ONESIGNAL_SAFARI_WEB_ID || "",
    GA_ID: process.env.GA_ID || ""
  },
  /*
  ** Headers of the page
  ** See https://nuxtjs.org/api/configuration-head
  */
  head: {
    title: 'Domain Monitor',
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
      { hid: 'og:title', name: 'og:title', content: 'Domain Monitor' },
      { hid: 'description', name: 'description', content: 'Keep track of your expiring domains today for FREE with our FREE domain monitoring product.' },
      { hid: 'og:description', name: 'og:description', content: 'Keep track of your expiring domains today for FREE with our FREE domain monitoring product.' }
    ],
    link: [
      { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
      { rel: 'stylesheet', href: 'https://fonts.googleapis.com/css2?family=Roboto:[email protected];400;700&display=swap' },
      { rel: 'stylesheet', href: 'https://fonts.googleapis.com/icon?family=Material+Icons' }
    ]
  },
  /*
  ** Global CSS
  */
  css: [
    '@/assets/scss/domain-monitor.scss'
  ],
  /*
  ** Bootstrap Vue
  */
  bootstrapVue: {
    bootstrapCSS: false,
    bootstrapVueCSS: false
  },
  /*
  ** Plugins to load before mounting the App
  ** https://nuxtjs.org/guide/plugins
  */
  plugins: [
    { mode: 'client', src: '@/plugins/bootstrap-vue-icons' },
    { mode: 'client', src: '@/plugins/vue-axios' },
    { mode: 'client', src: '@/plugins/vee-validate' },
    { mode: 'client', src: '@/plugins/vue-moment' },
    { mode: 'client', src: '@/plugins/content-images' },
    { mode: 'client', src: '@/plugins/content-videos' }
  ],
  /*
  ** Auto import components
  ** See https://nuxtjs.org/api/configuration-components
  */
  components: true,
  /*
  ** Nuxt.js dev-modules
  */
  buildModules: [
    ['@nuxtjs/google-analytics', {
      id: process.env.GA_ID
    }]
  ],
  /*
  ** Nuxt.js modules
  */
  modules: [
    'bootstrap-vue/nuxt',
    '@nuxtjs/axios',
    '@nuxtjs/auth',
    '@nuxtjs/onesignal',
    '@nuxtjs/pwa',
    '@nuxt/content',
    '@nuxtjs/sitemap',
    ['@nuxtjs/component-cache', { maxAge: 1000 * 60 * 5 }] // 5 minutes
  ],
  /*
  ** Auth config
  */
  auth: {
    redirect: {
      login: '/account/login',
      logout: '/account/login',
      callback: '/account/login',
      home: '/account/domains'
    },
    strategies: {
      local: {
        login: { url: 'auth/login', method: 'post', propertyName: 'token' },
        logout: { url: 'account/logout', method: 'post' },
        user: { url: 'auth/user', method: 'get', propertyName: 'user' }
      }
    }
  },
  /*
  ** One Signal
  */
  oneSignal: {
    init: {
      appId: process.env.ONESIGNAL_PUSH_APP_ID,
      safari_web_id: process.env.ONESIGNAL_SAFARI_WEB_ID,
      allowLocalhostAsSecureOrigin: true,
      welcomeNotification: {
          disable: true
      }
    }
  },
  /*
  ** Axios module configuration
  ** See https://axios.nuxtjs.org/options
  */
  axios: {
    baseURL: process.env.API_URL
  },
  /*
  ** Build configuration
  ** See https://nuxtjs.org/api/configuration-build/
  */
  build: {
    extractCSS: true,

    extend (config, ctx) {
      const vueLoader = config.module.rules.find((rule) => rule.loader === 'vue-loader')
      vueLoader.options.transformAssetUrls = {
        video: ['src', 'poster'],
        source: 'src',
        img: 'src',
        image: 'xlink:href',
        'b-img': 'src',
        'b-img-lazy': ['src', 'blank-src'],
        'b-card': 'img-src',
        'b-card-img': 'img-src',
        'b-card-img-lazy': ['src', 'blank-src'],
        'b-carousel-slide': 'img-src',
        'b-embed': 'src'
      }
    }
  },
  /*
  ** Sitemap configuration
  ** See https://www.npmjs.com/package/@nuxtjs/sitemap#setup
  */
  sitemap: {
    hostname: process.env.BASE_URL, // https://www.yoursite.com
    exclude: [
      '/account/recovery',
      '/account/reset',
      '/account/profile',
      '/account/domains/add',
      '/account/domains',
      '/account/monitors/add',
      '/account/monitors',
      '/help/account/introduction',
      '/help/monitors/introduction',
      '/help/domains/introduction'
    ],
    routes() {
      return getRoutes();
    },
  }
}

The contents of my getRoutes() function is…

export default async () => {
  const { $content } = require("@nuxt/content");
  const files = await $content({ deep: true }).only(["path"]).fetch();

  return files.map((file) => (file.path === "/index" ? "/" : file.path));
};

What is expected ?

URLs shouldn't show up in the generated sitemap.

What is actually happening?

The following URLs are still showing up in my sitemap:

- https://domain-monitor.io/help/account/introduction
- https://domain-monitor.io/help/monitors/introduction
- https://domain-monitor.io/help/domains/introduction

My URLs which I've excluded from my sitemap are still displaying even after generating the site multiple times and allowing a few hours for any potential caches to be purged.

Additional comments?

None

xixilalaha

xixilalaha posted a new question

sitemap-module •

format lastmod

i had format my lastmod.but it's still shown the UTC time

MostafaElGamal

MostafaElGamal posted a new question

sitemap-module •

How I can access context objects inside the module.

What I'm trying to do is to call the end-point to get data to the site-map but the end-point is dynamic so I want to access the '@nuxt/axios' module and that only happens inside the context object

Jesus82

Jesus82 posted a new question

sitemap-module •

Requests with Apollo

Hi, I want to make the request for the sitemaps routes with Apollo instead of with Axios. What would be the right way to do it?

I tried the same way than I do in the Vuex Store, but it doesn't seem to work (I get: Cannot read property 'apolloProvider' of undefined )

Here's my relevant part of nuxt.config.js

import gql from 'graphql-tag'

module.exports = {

sitemap: {
    path: '/sitemap.xml',
    hostname: 'https://example.com/',
    generate: true,
    cacheTime: 86400,
    trailingSlash: true,
    routes: async ({ app }) => {
        const myRoutes = ['/one-random-path/']
        let client = app.apolloProvider.defaultClient
        let myProductsQuery = gql`query {
              products {
                slug
              }
            }`
          let myBrandsQuery = gql`query {
              brands {
                slug
              }
            }`
          const myProducts = await client.query({ query: myProductsQuery })
          const myBrands = await client.query({ query: myBrandsQuery })

          return [myRoutes, ...myProducts, ...myBrands]
        }
    }
}
airBogdan

airBogdan posted a new question

sitemap-module •

Sitemaps caching

Hi there,
I am building approximately 70 full (50k records) sitemaps asynchronously, with paths created from db records.

Is there a way to cache these sitemaps so that they dont have to be rebuilt each time I deploy?
If they are built and created on the first build, if I comment out the code that generates them for the subsequent build, will they be removed or not?

Maybe this could be a solution?

I dont know if caching is the correct term here, Im not very experienced.

Thank you

mareestephan

mareestephan posted a new question

sitemap-module •

How to remove router base string from loc url

Sitemap is working fine, only issue is I cant figure out how to remove the base from showing up when the sitemap displays.

router: {
base: "/juno"

}

I would like to remove /juno/ from the url in in the loc element

eg. <loc>http://192.168.0.101:8080/juno/swarovski</loc>

Screen Shot 2020-10-19 at 15.39.25.png

neutraltone

neutraltone posted a new question

sitemap-module •

Creating a sitemap for subdomain which resides on the root level host.

Hi,

I've using a sitemap index to create multiple sitemaps. One for my Nuxt site, and one for a subdomain which houses a podcast. My configuration looks like this:

sitemap: {
    path: '/sitemap.xml',
    hostname: 'https://website.com',
    lastmod: new Date(),
    sitemaps: [
      {
        defaults: {
          changefreq: 'daily',
          priority: 0.8,
          lastmod: new Date(),
        },
        path: '/sitemap-www.xml',
        routes: [
          {
            url: '/',
            priority: 1,
          },
        ],
        gzip: true,
      },
      {
        defaults: {
          changefreq: 'daily',
          priority: 0.5,
          lastmod: new Date(),
        },
        hostname: 'https://podcast.website.com',
        path: '/sitemap-podcast.xml',
        routes: ['/route/to/podcast'],
        exclude: ['/**'],
        gzip: true,
      },
    ],
  },

This generates nearly everything fine, aside from one issue in my sitemap.xml file where it is using the hostname https://podcast.website.com as the reference to me sitemap-podcast.xml file, as opposed to route level domain which is `https://website.com.

For example, the module is generating the following in my sitemap.xml:

<loc>https://podcast.website.com/sitemap-podcast.xml.gz</loc>

Is there an option for it to generate the following in sitemap.xml, but preserve the subdomain in the sitemap-podcast.xml file itself?

<loc>https://website.com/sitemap-podcast.xml.gz</loc>

Thanks in advance.

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 😊