-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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
Fix & refactor server routing + add tests #799
Conversation
Deploy preview for docusaurus-preview ready! Built with commit cdc1c1e |
Just realized that we have a lot of bugs & inefficient regex for our server routing. 😂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me, given that you added appropriate tests that look to pass. I like the continued separation of services depending on the context as well.
I don't think this PR fixes it since just deals with the server and not https://docusaurus.io/sitemap.xml It contains - But that is the wrong URL - it should be Even shows on Google Search Console. |
@JoelMarcey #801 should fix it 😂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @endiliey! Just a couple of nits 👍
lib/server/server.js
Outdated
.toString() | ||
.split('blog/')[1] | ||
.toLowerCase(); | ||
if (file == 'atom.xml') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit - ===
lib/server/server.js
Outdated
res.send(feed('atom')); | ||
return; | ||
} else if (file == 'feed.xml') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit - ===
Motivation
Changes
sitemap.xml
routing to be properly on it's correct place.Example: when baseUrl is
/jest/
, it should only be accessible at/jest/sitemap.xml
and not at/sitemap.xml
blog/atom.xml
andblog/feed.xml
routing to be properly in it's correct placeblog/test.xml
or anyblog/*.xml
will sendblog/feed.xml
next
middleware function.html
files will hit this path, we should ignore it if it'sdocs
orblog
pages. 100% more efficientlib/core/routing.js
so that our routing is still true in v2http://localhost:3000/blog/2018/05/27/1.13.0
+ testBefore

After

Have you read the Contributing Guidelines on pull requests?
Yes
Test Plan
Test in development, everything work as per normal
