Use Slug in URL

Hi all!

I want to get my site’s content from the database.

so i’ve created a table with fields like title, body.
now I want to use slug’s to enter my website:

for my “about” page, my slug is “about”. if a user klicks a links “about”, then he will be redirected to the url “…com/mysite/about”.
this works fine.

The website’s content type is referencing to the databse table and the “about” record and I can display the content in my site.

my home site has the slug “home”. and this works also great in the url.

but I a user enter’s my site witout a slug added: “…com/mysite/”
then the content is empty (because no record with an empty slug will be found in the DB.

How can I achieve, that the page will grap the correct (home) record from the db, when the site is requested without a slug in the url?


Hello @jupixy

In that scneario what I would do is to redirect the user to your index page when the second item path is empty, nevertheless if you are building something where SEO is imperative or you need to conects google ads, Google can be a pain in the ass concerning this redirects.

On every page, create a workflow “When page is loaded”, and then with the conditional “When data from page url:item 2 is empty” and then create an action where you redirect the user for the correct URL.

If the slug is not correct, there is no way to request the data to your DB. Is like ask you to bring me a plate on my house without telling you where the kictchen is!

Nevertheless, can you explain me why you are creating your website on that way?

I am building a marketplace, where I use more less the same logic, the difference is, instead of creating the info on the DB (the static one), I created reausable elements where each element is visible depeding the url.

Kinds regards

Hi Bruno,

I chosed the way for easy content administration. I also want to store the bubble’s page’s SEO infos (like SEO description, SEO title…) in the db and fill the page’s variables from the db.

Is there any way to do the logic without having trouble with searh engines like google?

I wouldn’t redirect them to a different page, so no need to redirect to index page. Instead the goal is to have the same page which is the page you labeled as ‘mysite’ in your editor.

As it is true that redirects for SEO are bad, so instead of doing any redirect you can simply add another constraint onto the necessary areas that ‘when the slug is empty’ to use the values for the home record…this way when the slug is home it uses the home record and when the slug is empty it uses the home record and you will have no redirects.

Easiest way to do this to ensure SEO works properly, in the page title, description etc. you will use a dynamic expression that is ‘get data from URL’ path list items and reference path list item #2 is empty : formatted as text and in the yes area use the home record and in the no area use the relative slug value set.