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

the redirect plugin doesn't accept to links with anchors #8917

Closed
6 of 7 tasks
alewolf opened this issue Apr 23, 2023 · 1 comment
Closed
6 of 7 tasks

the redirect plugin doesn't accept to links with anchors #8917

alewolf opened this issue Apr 23, 2023 · 1 comment
Labels
closed: duplicate This issue or pull request already exists in another issue or pull request

Comments

@alewolf
Copy link
Contributor

alewolf commented Apr 23, 2023

Have you read the Contributing Guidelines on issues?

Prerequisites

  • I'm using the latest version of Docusaurus.
  • I have tried the npm run clear or yarn clear command.
  • I have tried rm -rf node_modules yarn.lock package-lock.json and re-installing packages.
  • I have tried creating a repro with https://new.docusaurus.io.
  • I have read the console error message carefully (if applicable).

Description

The following configuration will throw an error during the build.

[ERROR] ValidationError: "redirects[1].to" is not a valid pathname. Pathname should start with slash and not contain any domain or query string.

redirects: [
          {
            from: [
              '/pricing',
              '/pricing/',
            ],
            to: '/plugins/pmw/#pricing-section',
          },
        ],

In my opinion anchors should be allowed.

Reproducible demo

No response

Steps to reproduce

Paste this redirect configuration into docusaurus.config.js

redirects: [
          {
            from: [
              '/pricing',
              '/pricing/',
            ],
            to: '/plugins/pmw/#pricing-section',
          },
        ],

Expected behavior

The build should accept to links with anchors.

Actual behavior

The following error is thrown:

[ERROR] ValidationError: "redirects[1].to" is not a valid pathname. Pathname should start with slash and not contain any domain or query string.

Your environment

  • Docusaurus version used: 2.4.0
  • Environment name and version (e.g. Chrome 89, Node.js 16.4): Chrome 112.0.5615.121
  • Operating system and version (e.g. Ubuntu 20.04.2 LTS): OS X 13.3.1

Self-service

  • I'd be willing to fix this bug myself.
@alewolf alewolf added bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers labels Apr 23, 2023
@Josh-Cena
Copy link
Collaborator

Tracked in #6845

@Josh-Cena Josh-Cena closed this as not planned Won't fix, can't repro, duplicate, stale Apr 23, 2023
@Josh-Cena Josh-Cena added closed: duplicate This issue or pull request already exists in another issue or pull request and removed bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers labels Apr 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed: duplicate This issue or pull request already exists in another issue or pull request
Projects
None yet
Development

No branches or pull requests

2 participants