Skip to content

How would you implement this? (general pointers) #10229

Answered by slorber
Zenahr asked this question in Q&A
Discussion options

You must be logged in to vote

Docusaurus produces a static site so the link in the static markup are static by default.

That being said we could allow you to provide (or swizzle) your own Link component to replace/wrap ours, and eventually add stateful logic that kicks in after React hydration. But that seems overly complex.

What I would do is keep the links static, but link to a dynamic resource that knows where to redirect to (ie to which IP). You can persist the IP in a cookie instead of localStorage. You can prompt the user on first link access what's their IP address (or earlier if that makes sense) and the redirect to the correct ip-prefixed location.

This is what we do for docusaurus.new: the first time it redi…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Zenahr
Comment options

Answer selected by Zenahr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants