website
website copied to clipboard
feat: redirect known users
This is testing UX of redirecting known (have ajs_user_id
) users directly to console.
[!TIP] To make yourself a "known user" in the Vercel preview, open up web console and run
document.cookie = 'ajs_user_id=test'
How it works
-
Redirect from
neon.tech
toconsole.neon.tech
for anyone who has theajs_user_id
cookie set (this is a cookie that holds the user's platform UUID and is set AFTER they log in) https://github.com/neondatabase/website/blob/da8b9b27455beb830c43dfbe5283a31187af2786/next.config.js#L107-L123 -
Create a new clone of the homepage at neon.tech/home that is blocked from search engine indexes https://github.com/neondatabase/website/blob/da8b9b27455beb830c43dfbe5283a31187af2786/src/app/home/page.jsx#L1-L37
-
For visitors that have
ajs_user_id
set, make internal homepage links route to neon.tech/home instead of neon.tech Example: https://github.com/neondatabase/website/blob/da8b9b27455beb830c43dfbe5283a31187af2786/src/components/pages/404/hero/hero.jsx#L25 and https://github.com/neondatabase/website/blob/da8b9b27455beb830c43dfbe5283a31187af2786/src/utils/get-homepage-route.js#L1-L5 -
For visitors that have
ajs_user_id
, replace the "Sign Up" and "Log In" buttons with "Go to Console"
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
neon-next | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Jun 5, 2024 0:00am |
I like this. I think the main thing I notice is that docs, blog, changelog links are down on the left. If I was going to neon.tech
for a blog post I don't think I'd look there. When I compare to Vercel the top bar has those links as well as the bottom row. I don't think we need to move quickly to make a change to what they have but it's the first thing I noticed.
Hi @ruf-io,
The PR looks great! Could we refactor step 3 slightly to utilize the constant LINKS.home? I believe there are two potential options (or a combination of both):
- Add the property
home: getHomepageRoute()
to constant.js. - Implement a Next.js redirect from
/
to/home
in page.jsx when a cookie is present.
I believe these changes would not only help prevent users with cookies from accessing the /
page but also simplify the management of home page links throughout our project.
@americano98 Want to take over the PR and make the necessary changes?
Just hold off on merging. I need to get proper buy-in internally first.
@ruf-io I made some changes. Now, the workflow is as follows:
When a user visits the /
page, if they have a cookie, we check the headers to determine where the user came from. If it's an internal transition, we redirect them to /home
. If it's an external transition, we redirect them to console.neon.tech
.
This way, we can keep all links pointing to the index as /
. And thanks to server actions, we will generate the UI header on the server side