Site config url + baseUrl are not normalized and sensitive to leading/trailing slash
See original GitHub issueHave you read the Contributing Guidelines on issues?
- I have read the Contributing Guidelines on issues.
Prerequisites
- I’m using the latest version of Docusaurus.
- I have tried the
npm run clear
oryarn 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
- Set in config url to:
https://example.com/
- Build
- 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.
Issue Analytics
- State:
- Created a year ago
- Comments:5
Top Results From Across the Web
baseURL trailing slash should be consistent between site ...
Hello - it's been a while. If I set a baseURL in my config.toml, such as http://www.mysite.com, when I use {{ .Site.BaseURL }},...
Read more >Should I configure my URLs with a leading and/or trailing slash?
No leading slashes, but always use trailing ones ( http://my.app/ , path/to/resource/ ). Is there a best strategy? Would the strategies be ...
Read more >javascript - Return string without trailing slash - Stack Overflow
Try this: function someFunction(site) { return site.replace(/\/$/, ""); }.
Read more >Changelog - Rclone
Config parameters can now be passed as part of the remote name as a connection string. For example, to do the equivalent of...
Read more >REDCap Change Log - Eastern Virginia Medical School
Major bug fix: When attempting to upgrade to REDCap 12.5.13 (Standard), the REDCap upgrade page would mistakenly redirect the user back to the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Correct, I’m also a bit confused why our validation fails
baseUrl
without starting/ending/
when it could normalize that quite easily.Yes we don’t really make it failsafe on url/baseUrl config.
Even if user is using baseurl without leading/trailing slash afaik it cause troubles.
I’d be happy to normalize those:
/
/
I don’t think our config should reject/warn, but maybe just fix the user config automatically?