Slug on index page

I want to build something similar to Twitter: twitter.com/username

And show a profile group based on the slug - without having a separate page, e.g twitter.com/profile/username.

I tried putting a slug to a user data field and use “get data from page URL” but couldn’t get it to work.

Anyone can help a brother out?

1 Like

Hi @lukas.lau :wave:

The only way to do this is using your 404 page.

First, imagine that you have an User with the slug “lukas”.

When visitor types www.yoursite.com/lukas Bubble will not find the page “lukas”, so it will redirect the visitor imediatly to the 404 page. The information that your visitor is in the 404 page will not appear anywhere and your URL will remain the same as before.

In your 404 page just run a workflow “On page load” to Search for User’s where Slug is “lukas”. Done. You have your Users information and you can create his/her profile without problem.

The downside of this procedure is the redirection time (2 or 3 second) and the SEO. If they were not a problem, you can use this method.

2 Likes

The easy answer is your best practice is to use a path-name first.

Bubble itself does not support dynamic first paths.

Thanks so much Rafael! I can totally live with that downside!

However, I cant quite figure out how to grab the slug from the 404 page URL and how to run the “on pageload workflow”.

I tried this setup to display a user email but I seem to miss something…

Can you maybe assist on more time?

Figured it out!!

My 2 mistakes were:

  • I had privacy settings applied for everyone who is not logged in…wow
  • I had to choose path segments as list and not path

Thanks again Rafael!

1 Like

Great! :+1:

This topic was automatically closed after 69 days. New replies are no longer allowed.