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

liyasthomas
0
liyasthomas
commented 18 days ago

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

bug
0
liyasthomas
0
liyasthomas
commented 18 days ago

sitemap.xml generated from Travis CI build

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">
<url>
<loc>
http://travis-job-1c77f852-f86a-4ec6-8538-7abaa8d83c7f/settings
</loc>
</url>
<url>
<loc>
http://travis-job-1c77f852-f86a-4ec6-8538-7abaa8d83c7f/websocket
</loc>
</url>
<url>
<loc>
http://travis-job-1c77f852-f86a-4ec6-8538-7abaa8d83c7f/
</loc>
</url>
</urlset>

See the route locations are relative to build environment rather than base path.

0
NicoPennec
1.5k
NicoPennec
commented 18 days ago

I have checked your nuxt config and you build on spa mode.

In spa and generate mode, the "hostname" option is mandatory, because on build time nuxt can't know your final hostname. It can do it only on universal mode thanks to a Node.js server.
see doc: https://github.com/nuxt-community/sitemap-module#hostname-optional---string

I just created a PR to fix your config: https://github.com/liyasthomas/postwoman/pull/177

0
liyasthomas
0
liyasthomas
commented 17 days ago

Thanks for the quick PR ๐Ÿš€
Issue has been fixed and hence closing.

0
Informations
Bug Report โ€ข Open
#c68 - Created 18 days ago