fedeya / remix-sitemap

Sitemap generator for Remix applications
https://npmjs.com/remix-sitemap
MIT License
95 stars 5 forks source link

Regression bugs after updating from 2.2.1 to 2.2.6 #50

Closed kgkg closed 1 year ago

kgkg commented 1 year ago

Describe the bug After updating remix-sitemap from 2.2.1 to 2.2.6 and refreshing runtime generation of sitemap.xml there 2 differences since version 2.2.1. 1) entry for index path (http://localhost:3000) is missing 2) paths like _layout.contact.tsx without exported sitemap const used to be generated properly like http://localhost:3000/contact. After update they're being generated as http://localhost:3000/undefined/contact.

To Reproduce Steps to reproduce the behavior:

  1. Create routes/_layout.tsx with content (not sure if this is nessesasary)
    export default function LayoutWithData() {
    const outletData = useOutletContext<{}>();
    return (
        <div>
            <Outlet context={outletData} />
        </div>
    );
    }
  2. Create routes/_layout._index.tsx with any component code.
  3. Create routes/_layout.contact.tsx with any component code.
  4. Initialize sitemap in entry.server.tsx as described in remix-sitemap docs.
  5. Open sitemap.xml

Expected behavior In generated sitemap there should be entry for main path and correct entries for top-level routes.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

fedeya commented 1 year ago

Hi @kgkg, the new releases fix some issues with complex nested routes, but i forgot to handle the pathless routes.

I released a new version (2.2.7) trying to fix this problem, could you try again?

Thanks!

kgkg commented 1 year ago

Hi @fedeya, thanks for the patch - I compared both sitemaps and all seems to work great 👍