Comments (13)
Can you give the old url and the new url? I will create a 301 redirect middleware.
from styled-components-website.
I'd go for a 302 (hope that's the right code?) instead of a 301 to not have a permanent redirection in place.
The URL in question is: https://www.styled-components.com/docs/advanced#babel-plugin
It now lives at: https://www.styled-components.com/docs/tooling#babel-plugin
It'd be great to define these rules here: https://github.com/styled-components/styled-components-website/blob/master/pages/docs.json
Under a new key, like movedPages
from styled-components-website.
Why do you want a 302? Is it a temporary change? The browser would work fine though, Google however would not record the change and will always follow the old url in this case.
from styled-components-website.
Google however would not record the change and will always follow the old url in this case.
Oh that's unfortunate
Why do you want a 302? Is it a temporary change?
I think a simple 301 won't pick up on the hash/anchor part of the URL, right? I might be mistaken. Either way, I'd like to be careful about permanent, cached redirections that make it impossible to undo anything.
from styled-components-website.
Hash/Anchor arent picked up by the server IMO, they are only browser based, I tried to get the hash, I could not get it in the request
Check this https://stackoverflow.com/questions/9967681/nodejs-url-with-hash
So basically this has to be picked up on the frontend and redirection should happen which again is not a good way. Please suggest.
from styled-components-website.
So basically this has to be picked up on the frontend and redirection should happen which again is not a good way. Please suggest.
We can add a componentDidMount
to our document and detect whether a redirect is necessary here: https://github.com/styled-components/styled-components-website/blob/master/pages/_document.js
from styled-components-website.
Won't work. document.js only executes server side.
from styled-components-website.
@harshmaur we can actually use the API to inject an HOC around the app and detect it there. It’s currently non-standard I.e. not released on next yet, but we’ve got it in our censored version to make styling ssr work
from styled-components-website.
I am not aware, Could you explain more? I would then be able to do it. Also redirection on the frontend is not that pretty with nextjs. https://github.com/zeit/next.js/wiki/Redirecting-in-%60getInitialProps%60
from styled-components-website.
@harshmaur here we’re wrapping the app in our StyleSheetManager. You can just create another Redirect component that wraps it as well and use and add the redirect logic to componentDidMount
https://github.com/styled-components/styled-components-website/blob/master/pages/_document.js#L150
from styled-components-website.
I see!! Let me try to do it now.
from styled-components-website.
@harshmaur need any help here?
from styled-components-website.
@mckernanin Hey! You can take this up!
from styled-components-website.
Related Issues (20)
- Spectrum chat link is not found HOT 1
- spe
- Add [project] by [company] to showcase
- Add FAQ on NextJS 13 usage HOT 2
- Add [project] by [company] to showcase HOT 1
- Need a FAQ page added for this HOT 3
- Add [project] by [company] to showcase
- Add [project] by [company] to showcase
- Wrong Link in the docs for v6 migration
- Add [project] by [company] to showcase
- Add [project] by [company] to showcase
- Add [project] by [company] to showcase
- Add [project] by [company] to showcase
- Add [project] by [company] to showcase
- Add [project] by [company] to showcase
- On the homepage live edit example, the cursor is off by 1 character HOT 1
- Add [project] by [company] to showcase
- Add [project] by [company] to showcase
- Add [project] by [company] to showcase ok
- Inaccurate `shouldForwardProp` description
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from styled-components-website.