[new docs site] relative links on URLs with and without a trailing slash
See original GitHub issueEnvironment
main
branch, npm start
in the docs
directory.
What parser are you using?
Default (Espree)
What did you do?
Open USER GUIDE > Rules > no-cond-assign. Then, in the Related Rules section click no-extra-parens link.
What did you expect to happen?
To open no-extra-parens document.
What actually happened?
The link is broken as it points to rules/no-cond-assign/no-extra-parens
.
Participation
- I am willing to submit a pull request for this issue.
Additional comments
This is caused by writing rules/no-cond-assign.md
to rules/no-cond-assign/index.html
, unlike the current site where it is rules/no-cond-assign.html
. The path on the new site is rules/no-cond-assign/
(with /
at the end) as opposed to the current site where it is rules/no-cond-assign
(without /
at the end) so the relative links in the document are broken.
Issue Analytics
- State:
- Created a year ago
- Comments:16 (16 by maintainers)
Top Results From Across the Web
Fix trailing slash issues (depend on hosting provider) #3372
Another idea is to resolve all relative links at build time to absolute links, so that the presence of a trailing slash or...
Read more >Relative links change if page called without trailing slash
However, any relative links within the page seem to think the page is one level higher when the page is called without the...
Read more >Built relative URL in pages that are missing trailing slash
The reason we need to do this is because we need relative links to the current page. The CMS system that we are...
Read more >To slash or not to slash | Google Search Central Blog
Historically, it's common for URLs with a trailing slash to indicate a directory, and those without a trailing slash to denote a file:....
Read more >Trailing slashes on URLs: Contentious or settled?
It's a client-side thing, not a server-side thing. That is, if you have a resource (like an href to another page) in your...
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 Free
Top 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
On the current site, this page is https://eslint.org/docs/user-guide/getting-started (without trailing slash). Relative links on the page were set based on the URL without the trailing slash, and the current site redirects https://eslint.org/docs/user-guide/getting-started/ to https://eslint.org/docs/user-guide/getting-started, so it always works well.
On the new site, redirects don’t work, and with the trailing slash in https://new.eslint.org/docs/user-guide/getting-started/ relative links on the page are broken.
I think we should decide on the approach first. Some ways to address this might be:
/
) everywhere. It would probably be good to also decide for each page what would be its canonical URL, and generaterel="canonical"
link tags and the sitemap accordingly.Ooh,
<base>
seems like a good idea. Let’s try that: https://github.com/eslint/eslint/pull/16046Alternate approach: