CMS Development

jcromero
Member | Diamond Partner
Member | Diamond Partner

Multilevel Dynamic Pages

SOLVE

Hello everyone!
Im having trouble with the second level and it is displaying a 404!
Here is my code....

 

I can display the Countries, then by clicking the selected country i can access the Country with the people names...But when i click on any person name it shows me a 404 but the url path is still correct. Any thoughts on what im doing wrong?

 

Thank you very much!

 

{% if dynamic_page_route_level == 0 %}
<h1>Countries</h1>
{% set rows = hubdb_table_rows(dynamic_page_hubdb_table_id) %}


{% for row in rows %}
<h2><a href="{{ request.path }}/{{ row.hs_path }}">{{ row.hs_name }}</a></h2>
{% set childRows = hubdb_table_rows(row.hs_child_table_id) %}
{% for childRow in childRows %}
<li><a href="{{ request.path }}/{{ row.hs_path }}/{{childRow.hs_path}}">{{ childRow.hs_name }}</a></li>
{% endfor %}
{% endfor %}

{% elif dynamic_page_route_level == 1 %}
<h1>Country</h1>
<h2>{{dynamic_page_hubdb_row.hs_name}}</h2>
{% set rows = hubdb_table_rows(dynamic_page_hubdb_row.hs_child_table_id) %}


{% for row in rows %}
<li><a href="{{ request.path }}/{{ row.hs_path }}">{{ row.hs_name }}{{ row.apellido }}</a></li>
{% endfor %}

{% elif dynamic_page_route_level == 2 %}
<h1>Person</h1>
<h1>{{ dynamic_page_hubdb_row.hs_name }}</h1>
<h2>{{ dynamic_page_hubdb_row.hs_name }}{{ dynamic_page_hubdb_row.apellido }}</h2>
{% endif %}

0 Upvotes
1 Accepted solution
jcromero
Solution
Member | Diamond Partner
Member | Diamond Partner

Multilevel Dynamic Pages

SOLVE

Hi! after several days of troubleshooting and reading documentation and related posts, i found the error! So, this was a rookie mistake that is probably going to help someone in the future! Everytime you make changes to your DB, ALWAYS REMEMBER to publish them! Also, if you make changes in the DB settings make sure you save them as well! I was looking for the error making sure i've follow the correct setup and found up that a simple "save" and publish button was never ever clicked after making some DB changes. 

View solution in original post

6 Replies 6
jcromero
Solution
Member | Diamond Partner
Member | Diamond Partner

Multilevel Dynamic Pages

SOLVE

Hi! after several days of troubleshooting and reading documentation and related posts, i found the error! So, this was a rookie mistake that is probably going to help someone in the future! Everytime you make changes to your DB, ALWAYS REMEMBER to publish them! Also, if you make changes in the DB settings make sure you save them as well! I was looking for the error making sure i've follow the correct setup and found up that a simple "save" and publish button was never ever clicked after making some DB changes. 

Jaycee_Lewis
Community Manager
Community Manager

Multilevel Dynamic Pages

SOLVE

Thank you, @jcromero for taking the time to come back and share your update. It has definitely happened to us all 😊 And you are correct, your post will certainly help other folks in the future!

 

Best,

Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

0 Upvotes
jcromero
Member | Diamond Partner
Member | Diamond Partner

Multilevel Dynamic Pages

SOLVE

Thanks again for yor answer! I have admin permissions and im working on a demo page so i can learn to use dinamic pages, do you have any other thoughts on what am i doing wrong? maybe it's still on my code...

The title for my page in set to "latam" so the routes are supposed to be /latam/country/person ? i dont know if im getting it right but thast what im getting... and i guess its OK to be so...or not? For level 0 (latam) im getting all latam countries i want, then on level 1, im getting a single country with the new route /latam/argentina... but for level 2 im getting the 404 error but the url changes properly to /latam/argentina/leandro.... im still not getting it

0 Upvotes
himanshurauthan
Thought Leader | Elite Partner
Thought Leader | Elite Partner

Multilevel Dynamic Pages

SOLVE

Hello @jcromero 

It looks like there might be an issue with the URL path that you are generating for the person's page.

In your code, you are generating the URL path for the person's page using {{ request.path }}/{{ row.hs_path }}/{{childRow.hs_path}}. This concatenates the current path with the paths for the country and person. However, it looks like you are missing a slash between the country path and the person path, which can cause a 404 error when trying to access the person's page.

To fix this, you can add a slash between the country path and the person path in your URL path generator like this: {{ request.path }}/{{ row.hs_path }}/{{childRow.hs_path}}. This should generate the correct URL path for the person's page and allow you to access it without a 404 error.

Thanks & Regards 
Himanshu Rauthan

Digital Marketing & Inbound Expert In Growth Hacking Technology
jcromero
Member | Diamond Partner
Member | Diamond Partner

Multilevel Dynamic Pages

SOLVE

Hello and thanks for your answer! Actually in the code i passed, there is a slash where you say and when trying to access the second level, my URL changes correctly like this : /latam/argentina/leandro but still throws back a 404... Havent been able to fix this yet

0 Upvotes
himanshurauthan
Thought Leader | Elite Partner
Thought Leader | Elite Partner

Multilevel Dynamic Pages

SOLVE

I see, thank you for the clarification. In that case, it is possible that the issue might be with the configuration of your server or with the routing settings in your code.
There might be an issue with the permissions or access settings for the person's page. Make sure that the page is published and accessible to the appropriate users or groups.

Digital Marketing & Inbound Expert In Growth Hacking Technology
0 Upvotes