Activities

padinko

padinko posted a new feature request

sitemap-module •

idea Get routes config in routes function

What problem does this feature solve?

We are using named dynamic routes (path can change, but name doesn't, so all occurences of path in app are changed automaticly). Now we use api to generate dynamic routes, but can't access actual router config, so we can only staticly add this routes.. but when path changed, we need to change sitemap routes too. It will be great if we can use named routes and change only path and sitemap will still work without change

What does the proposed changes look like?

there will be router config in router parameter (probably second, so callback is still usable)

-or-

there will be some this in router function where we can access router config

miteyema

miteyema posted a new bug report

sitemap-module •

bug sitemap via SRR not working on zeit now

Version

2.0.1

Reproduction link

https://github.com/miteyema/nuxt-sitemap-now

Steps to reproduce

  • I have an api serverless function to return the dynamic routes so I can build a complete sitemap
  • The dynamic routes are added to nuxt generate, so they are available for the sitemap module
  • SRR app works in dev mode, but once deployed with zeit now in production (using nuxt/now-builder), it's not working
  • If I use nuxt generate (to make a static app), sitemap does work

This is the config object for sitemap in nuxt.config.js:

 sitemap: {
    hostname: baseURL,
    defaults: {
      lastmod: new Date(),
      changefreq: 'weekly',
      priority: 0.8
    }
}

The generate part in nuxt.config.js:

generate: {
    async routes() {
      const response = await axios.get('routes', {
        // FYI: generate will always be in production mode
        baseURL: apiBaseURL
      })
      const dynamicRoutes = response.data
      return dynamicRoutes
    }
}

What is expected ?

sitemap.xml is shown

What is actually happening?

"Nuxt.js Internal Server Error" is show with status code 500.
The following log is shown on the server:

ERROR  Cannot read property 'filter' of null
  at node_modules/@nuxtjs/sitemap/lib/routes.js:14:21
  at Array.forEach (<anonymous>)
  at excludeRoutes (node_modules/@nuxtjs/sitemap/lib/routes.js:11:12)
  at Object.cache.staticRoutes (node_modules/@nuxtjs/sitemap/lib/middleware.js:48:30)
  at AsyncCache.load [as _load] (node_modules/@nuxtjs/sitemap/lib/cache.js:19:68)
  at processTicksAndRejections (internal/process/task_queues.js:94:5)
everyx

everyx posted a new feature request

sitemap-module •

idea Allow manually configure routes in SSR mode

What problem does this feature solve?

Thus, when in SSR mode, we can get robots.txt data from api and dynamically generate robots.txt.

like nuxt-community/gtm-module

GTM Initialisation

If you want to block Google Tag Manager before user directly allows (GDPR realisation or other), you can set autoInit option to false and then manually enable using $gtm.init().

Note: All events will be still buffered in data layer but won't send until init() method getting called.

This question is available on Nuxt community (#c80)

What does the proposed changes look like?

  1. Add option to disable auto init
  2. Add new manually init function and have capacity to pass routes
everyx

everyx posted a new question

sitemap-module •

Allow init routes manually in nuxtServerInit?

Thus, when in SSR mode, we can get robots.txt data from api and dynamically generate robots.txt.

like nuxt-community/gtm-module

GTM Initialisation

If you want to block Google Tag Manager before user directly allows (GDPR realisation or other), you can set autoInit option to false and then manually enable using $gtm.init().

Note: All events will be still buffered in data layer but won't send until init() method getting called.

JohanneA

JohanneA posted a new question

sitemap-module •

Creating sitemap index based on dynamic sitemaps

I am trying to create a sitemapindex based on a total amount of pages returned by a request to my CMS. However, when I try I get this error The path option is either empty or missing in your config for a sitemap. Which makes sense, since it isn't expecting an async function for the configuration.

I am not quite sure how to solve my problem though. Is there a way to dynamically generate the sitemap?

This is what I'm trying to do:

const getNewsItemSiteMaps = () =>
    newsItemRequest().then((response) => {
      const totalPages = response.total_pages;

      return range(totalPages).map(it => (
        {
          path: `sitemap-posts-${it}.xml`,
          routes: () => getNewsItemRoutes(it + 1),
          cacheTime: 1000 * 60 * 60 * 2,
          exclude: ["/**"]
        }
      ));
    });

nuxt.config.js

sitemap: {
...
  sitemaps: [
    getNewsItemSiteMaps()
  ]

}
sandalwoodsh

sandalwoodsh posted a new question

sitemap-module •

routes var in generate section will auto generate sitemap content

If routes are not defined here:
sitemap: {
path: "/sitemap.xml",
hostname: "https://example.com"
}

AND a variable "routes" is found in the generate section, then the routes will be added automatically to the sitemap file.

generate: {
routes: function() {
return axios
.get(“blahblahblah”)
.then(res => {
const routes = [];
[…]

      return routes;
    });
}

}

ftpyz

ftpyz posted a new question

sitemap-module •

how to generate only sitemap from console or command

how to generate only sitemap from console or command. i want to run schedule job for my sitemap.

AlanLeonard

AlanLeonard posted a new feature request

sitemap-module •

idea Make sitemap module compatible with output from @nuxtjs/router

What problem does this feature solve?

Currently, if I want to use the @nuxtjs/router I'm left with a blank sitemap which doesn't take into account the custom routes I added manually in my router.js file as per @nuxtjs/router documentation. This would eliminate redundancy of definition of routes

What does the proposed changes look like?

Instead of using the result of createRoutes from nuxt, the manual router.js code could be parsed and used.

jd1378

jd1378 posted a new bug report

sitemap-module •

bug image caption is always wrapped in CDATA in the output xml

Version

2.0.1

Reproduction link

https://codesandbox.io/s/epic-chatterjee-pnzlr

Steps to reproduce

use image with a caption in a route

What is expected ?

<url>
  <loc>https://examplee.com/</loc>
  <changefreq>weekly</changefreq>
  <priority>0.8</priority>
  <image:image>
    <image:loc>https://example.com/some-image.png</image:loc>
    <image:caption>normal string</image:caption>
  </image:image>
</url>

What is actually happening?

<url>
  <loc>https://examplee.com/</loc>
  <changefreq>weekly</changefreq>
  <priority>0.8</priority>
  <image:image>
    <image:loc>https://example.com/some-image.png</image:loc>
    <image:caption><![CDATA[normal string]]></image:caption>
  </image:image>
</url>

Additional comments?

And i don't know why my sandbox does not even generate the xml file properly anyway.
I tried setting "cdata" to false in sitemap options defaults but it didn't help.
I have tested the route example in the sandbox on my local environment and it got wrapped in cdata

jd1378

jd1378 posted a new question

sitemap-module •

image caption is always wrapped in CDATA in the output xml

I'm not sure whats causing it but even if there's a character somewhere in the file that needs to be escaped, It shouldn't wrap everything in CDATA.
example:

<url>
  <loc>https://examplee.com/</loc>
  <changefreq>weekly</changefreq>
  <priority>0.8</priority>
  <image:image>
    <image:loc>https://example.com/someimage.png</image:loc>
    <image:caption><![CDATA[normal string]]></image:caption>
  </image:image>
</url>
NicolasGiuristante

NicolasGiuristante posted a new feature request

sitemap-module •

idea i18n Multilingual Nuxt Website - The right way - rel-alternate-hreflang

What problem does this feature solve?

Hello! 👋🏼

Proposition : Automatically generate adequate sitemap with the concept rel-alternate-hreflang proposed by Google itself when using nuxt-i18n paths feature.

Why : Multilingual website cannot benefit from this plugin's automatic sitemap generation at the moment without heavy modifications/custom code. It would greatly help newcomers that doesn't know how to code this properly AND devs who do not know SEO's current best practices towards multilingual websites.

Source : Tell Google about localized versions of your page[https://support.google.com/webmasters/answer/189077?hl=en]

I am sure this can be implemented easily. nuxt-i18n is already supporting this rel-alternate-hreflang concept with link tags in the head.

What does the proposed changes look like?

Exemple

// contact.vue
nuxtI18n: {
    paths: {
        en: '/contact-us',
        fr: '/contactez-nous',
    },
},

Would generate

// generated sitemap.xml
<url>
    <loc>https://example.ca/en/contact-us/</loc>
    <xhtml:link rel="alternate" hreflang="fr-ca" href="https://example.ca/fr/contactez-nous/" />
    <xhtml:link rel="alternate" hreflang="en-ca" href="https://example.ca/en/contact-us/" />
    <changefreq>monthly</changefreq>
    <priority>1.0</priority>
</url>

Root page x-default when all locales are prefixed
Bonus point if you could support for the newest x-default value on root when i18n's option strategy = prefix

// generated sitemap.xml
<url>
    <loc>https://example.ca/</loc>
    <xhtml:link rel="alternate" hreflang="fr-ca" href="https://example.ca/fr/" />
    <xhtml:link rel="alternate" hreflang="en-ca" href="https://example.ca/en/" />
    <xhtml:link rel="alternate" hreflang="x-default" href="https://example.ca/" />
    <changefreq>monthly</changefreq>
    <priority>1.0</priority>
</url>
mojtaba06

mojtaba06 posted a new feature request

sitemap-module •

idea Consider Router Base

What problem does this feature solve?

If defined the router base in nuxt.config.js file, the links in the sitemap file did not consider that.
router: {
base: '/something/'
}

What does the proposed changes look like?

When creating the links in the sitemap file, It would be nice that consider the router base to make the real link.

maxnik1994

maxnik1994 posted a new question

sitemap-module •

Incorrect generation of routes

Hey. There was an incomprehensible situation when using the @ nuxtjs / sitemap package.
When generating a system map file, the static paths were displayed incorrectly (without a domain name). Wrong old women: https://about/, https://contact/, https://news/, https://test/.Tell me how to solve the problem. Thank.
Снимок333

maxnik1994

maxnik1994 posted a new question

sitemap-module •

Incorrect generation of routes

Hey. There was an incomprehensible situation when using the @ nuxtjs / sitemap package.
When generating a system map file, the static paths were displayed incorrectly (without a domain name). Wrong old women: https://about/, https://contact/, https://news/, https://test/.Tell me how to solve the problem. Thank.
Снимок333.PNG

starikovm

starikovm posted a new feature request

sitemap-module •

idea Force https urls

What problem does this feature solve?

I have a website running on https on heroku, so https request via CNAME goes to herou and website is hosted there.
What am I experiencing now is that isHTTPS(req) function on production is returning false for these kind of requests, probably because of current hosting architecture.

I wanted to raise a PR with an option for forced https links in sitemap to avoid such issues and such situations.

What does the proposed changes look like?

Option in sitemaps module like forceHTTPS, which then creates all links with https reagrdless of request type and so on.

liyasthomas

liyasthomas posted a new bug report

sitemap-module •

bug sitemap.xml generated in Travis CI build have routes relative to Travis CI build job and not actual routes.

Version

2.0

Reproduction link

https://postwoman.io/sitemap.xml

Steps to reproduce

  1. Build nuxt application in Travis CI
  2. Deploy the application
  3. Find the /sitemap.xml generated
  4. Routes are relative to CI build job and not actual routes

What is expected ?

Routes should be relative to base path and not relative to build environment.

What is actually happening?

Instead of base path, build environment is considered as the root and /pages/routes are set relative to build enironment

mornir

mornir posted a new question

sitemap-module •

Cache Invalidation

Hi!
Does the cached sitemap gets invalidated every time my website is rebuild with nuxt generate?
If yes, what would be the recommended value for the cacheTime property? Disabling it with the value 0 or setting to a long period?

And thanks for this useful module!

BobDempsey

BobDempsey resolved the question #c66

sitemap-module •

/sitemap.xml not rendering on live website

Hey you can delete this if needed. It worked when I deployed the entire nuxt project to my host. Thank you though!

BobDempsey

BobDempsey posted a new question

sitemap-module •

/sitemap.xml not rendering on live website

Hey I'm having difficulties with getting the actual sitemap page to display on my live website. It works just fine using run && build.

Any help much appreciated! I've tried both sitemap configs.

nuxt.config.js

modules:["@nuxtjs/sitemap"],

sitemap: {
hostname: "https://silentauctionvacations.com",
path: "/sitemap.xml",
exclude: ["/admin/**"]
}

OR

sitemap: {
exclude: ["/admin/**"]
}

adfdev

adfdev posted a new question

sitemap-module •

Nuxt.js Internal Server Error

Have this settings for sitemap:

  sitemap: {
    routes: [
      "/",
      "/en"
    ],
    path: '/sitemap.xml',
  },

in dev mode and in production mode (npm start) can see /sitemap.xml, but when deploy have this error:

Nuxt.js Internal Server Error