Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generated sitemap results in extra slashes #105

Closed
684efs3 opened this issue Jan 24, 2024 · 3 comments
Closed

Generated sitemap results in extra slashes #105

684efs3 opened this issue Jan 24, 2024 · 3 comments

Comments

@684efs3
Copy link

684efs3 commented Jan 24, 2024

I am using remix-flat-routes with Remix+Vite as well as nasa-gcn/remix-seo.

The generated sitemap has extra slashes after the domain name, e.g. https://abc.com//xyz.

My routes folder looks something like this:

routes
   _auth+
     login.jsx
     profile.jsx
   _marketing+
     privacy.mdx
     terms.mdx
   _blog+
     hello
       route.jsx
     test.mdx

Only /login and /profile are correctly generated in the sitemap. The other ones will have an extra slash.

My vite.config.ts looks like this:

remix({
      ignoredRouteFiles: ['**/*'],
      routes: async defineRoutes => {
        return flatRoutes('routes', defineRoutes)
      }
    }),

My sitemap[.]xml.js looks like this:

import { generateSitemap } from '@nasa-gcn/remix-seo'
import { siteConfig } from '../../utils/site-config'

export async function loader ({ request }) {
  //@ts-ignore - This may fail during docker build typecheck if the app isn't build yet
  let build = await (import.meta.env.DEV
    ? import('../../build/server/index.js')
    : import(
        /* @vite-ignore */
        import.meta.resolve('../../build/server/index.js')
      ))

  return generateSitemap(request, build.routes, {
    siteUrl: siteConfig.url,
    headers: {
      'Cache-Control': `public, max-age=${60 * 5}`
    }
  })
}

@github.com/nasa-gcn/remix-seo/issues/7

@lpsinger
Copy link

See nasa-gcn/remix-seo#8.

@kiliman
Copy link
Owner

kiliman commented Feb 20, 2024

Sorry for not seeing this sooner. I'll take a look.

@kiliman
Copy link
Owner

kiliman commented Feb 20, 2024

I believe this is an issue with remix-seo.

nasa-gcn/remix-seo#7 (comment)

@kiliman kiliman closed this as completed Feb 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants