Skip to content

Bug: routeRules not working with non-root baseUrl #27

Description

@SOULIER-Patrice

Bug: routeRules not working with non-root baseUrl

Description

When using a non-root baseUrl (required for GitLab Pages deployment), routeRules are not applied correctly, resulting in incorrect section categorization in the generated llms.txt file.

Environment

* Plugin version: `@signalwire/docusaurus-plugin-llms-txt@1.2.2`
* Deployment target: GitLab Pages

Expected Behavior

When using baseUrl: "/documentations/user-manual", the routeRules should correctly categorize pages under their specified section names (e.g., "Docs", "Blog", "Announcements") in the generated llms.txt.

Actual Behavior

With baseUrl: "/documentations/user-manual":

* `routeRules` are not applied
* `llms.txt` only contains a `## documentations` section
* Expected sections like `## Docs` (from `/documentations/user-manual/docs`) are missing

With baseUrl: "/":

* `routeRules` work correctly
* All sections (Docs, Blog, Announcements) appear properly in `llms.txt`

Notes

* `excludeRoutes` works correctly with both root and non-root `baseUrl` when prefixed with `${baseUrl}`
* Relative paths in `llms.txt` are correct for both `baseUrl` configurations (e.g., `/announcements/2024/10/06/article.md` without the baseUrl prefix)

Configuration

`const baseUrl = "/documentations/user-manual/";

export default {
  baseUrl: baseUrl,
  plugins: [
    [
      '@signalwire/docusaurus-plugin-llms-txt',
      {
        content: {
          includeBlog: true,
          enableLlmsFullTxt: true,
          excludeRoutes: [
            `${baseUrl}search/`,
            `${baseUrl}blog/`, 
            `${baseUrl}blog/page/*`,   
            `${baseUrl}blog/tags/**`,  
            `${baseUrl}blog/archive/`, 
          ],
          routeRules: [
            {
              route: `/docs/**`,  // Doesn't work ✗
              depth: 1,
              categoryName: 'Docs'
            },
            {
              route: `/blog/**`,  // Doesn't work ✗
              depth: 1,
              categoryName: 'Blog'
            },
            {
              route: `/announcements/**`,  // Doesn't work ✗
              depth: 1,
              categoryName: 'Announcements'
            }
          ],
        }
      },
    ],
  ],
};
`

Attempted Solutions

I've tried multiple route pattern variations without success:

`// All of these failed to work with non-root baseUrl:
route: `/docs/**`
route: `docs/**`
route: `**/docs/**`
route: `${baseUrl}/docs/**`
route: `${baseUrl}docs/**`
`

Reproduction

  • Set baseUrl to a non-root path (e.g., /documentations/user-manual/)
  • Configure routeRules as shown above
  • Build the site
  • Check generated llms.txt - sections will not be categorized correctly

Possible Root Cause

It appears that excludeRoutes and routeRules use different matching mechanisms.

Activity

  1. SOULIER-Patrice commented on Jan 9, 2026

    @SOULIER-Patrice
    Author

    I used 2.0.0-alpha.7 and it fixed my issue. Do you plan to release 2.0.0 soon?

  2. Devon-White commented on Jan 22, 2026

    @Devon-White
    Collaborator

    I used 2.0.0-alpha.7 and it fixed my issue. Do you plan to release 2.0.0 soon?

    Its on my list to do once I have some free time (been very busy with a project lately). I'll see if i can slot some time this weekend :)

  3. self-assigned this
    on Jan 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions