-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 links on both github and website #576
Conversation
packages/site/gatsby-node.js
Outdated
.replace(/\.md(#.*)?$/, (match, hash) => { | ||
return hash | ||
}) | ||
.replace(/^\/packages\//, '/docs/') |
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.
All the main code for creating proper urls is here.
- [css prop](https://github.com/emotion-js/emotion/tree/master/docs/css#CSS-Prop.md) | ||
- [composition](https://github.com/emotion-js/emotion/tree/master/docs/composition.md) | ||
- [keyframes](https://github.com/emotion-js/emotion/tree/master/docs/keyframes.md) | ||
- [fontFace](https://github.com/emotion-js/emotion/tree/master/docs/font-face.md) |
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.
deleted fontFace, could not find appropriate url
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 will break doc links when viewed on npm. The links should be in the format https://emotion.sh/docs/doc-name
so that everything links to the site. The https://emotion.sh
is stripped out here so that the links work on netlify previews and etc.
So that is the culprit, along with removing emotion/packages/site/gatsby-node.js Line 194 in 42ab721
to node.url = node.url.replace(/^https?:\/\/emotion.sh/, '') |
NPM also follows relative links when present in Readme.md of packages. I've changed only one url from And can you help me how to use netlify preview. |
@azizhk Yep, make that change. |
Thank you! |
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.
Could you run yarn lint
and commit the changes so that prettier fixes the formatting?
Hey yeah sorry about the lint errors, actually I somehow could not setup lerna properly. I Also please need help with #573 |
@azizhk you don't actually need to run yarn bootstrap anymore (we need to update the CONTRIBUTING.md), we don't have any githooks. What do you mean by it didn't install all the dependencies? What happened instead of everything being installed? |
@azizhk You need to run Personally, I'm not big on githooks because I find they get annoying since I already having linting in my editor but I wouldn't mind hearing @tkh44's opinion, I don't care that much so if @tkh44 thinks it's a good idea then sure. |
A lot of links were broken on the website when trying to open them in a new tab. This is because they were relative urls like
docs/css
, so if you were on a pages likehttps://emotion.sh/docs/install
then the url would becomehttps://emotion.sh/docs/docs/css
. Double/docs/
The urls were working if opened in the same tab because the gatsby-plugin-catch-links was somehow catching them correctly.
I ran http://www.brokenlinkcheck.com/ on https://emotion.sh and got the following 404s.

My approach was that the links should work on github as well as on the website.
Like if you go to https://github.com/azizhk/emotion/blob/1bf4eba72a8e11660cb4dc7b7a4ed717afae9b58/docs/babel.md and click on the last link then it should work and take you to the corresponding markdown file in the repository.