Skip to content

Site config url + baseUrl are not normalized and sensitive to leading/trailing slash #7989

@aniaq

Description

@aniaq

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

Meta data "og:url" - url has double slashes in the prerendered HTML

<meta data-rh="true" property="og:url" content="https://example.com//docs/courses/how-are-the-course-accessed-with-the-lifetime-membership/">

It happens when slash is added at the end of the URL in docusaurus.config.js, in my case
url: 'https://example.com/'

Reproducible demo

No response

Steps to reproduce

  1. Set in config url to: https://example.com/
  2. Build
  3. Search HTML code for og:url

Expected behavior

One slash in the URL

Actual behavior

Double slashes in the URL

Your environment

  • Public source code:
  • Public site URL: docs.divi.space
  • Docusaurus version used: 2.0.1
  • Environment name and version (e.g. Chrome 89, Node.js 16.4): node v16.17.0
  • Operating system and version (e.g. Ubuntu 20.04.2 LTS): macOS Monterey 12.2

Self-service

  • I'd be willing to fix this bug myself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAn error in the Docusaurus core causing instability or issues with its executiondomain: trailing slashRelated to trailing slash config

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions