We use cookies to make HubSpot's community a better place. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. To learn more, and to see a full list of cookies we use, check out our Cookie Policy (baked goods not included).
Jun 21, 2021 3:43 PM - edited Jun 21, 2021 3:47 PM
Hi
I'm trying to figure out why my Hubl code is resulting in a url error.
I have this code:
{% set pop_posts = blog_popular_posts('Named Blog', 5) %}
{% for pop_post in pop_posts %}
<a class="post-title d-block mb-3" href="{{ pop_post.absolute_url }}">{{ pop_post.name }}</a>
{% endfor %}
The expected output would be something like www.somesite.com/blog/some-article.
What I am getting is www.somesite.com/blog/blog/some-article.
I also tried, pop_post.slug. FYI
Can someone point me in the right direction as to why this isn't working?
Solved! Go to Solution.
Jun 23, 2021 5:52 AM
Hi @JErkelens,
I've tried your code with "Default" as blog and I'm getting the correct URL.
Are you getting the .../blog/blog/... in the module preview or on the "live" page?
If it's in the live page - could you please check if you have something in the redirects? Maybe there is a /blog/ redirect set which collides. Also you can check your Blog settings(don't change anything - just check). maybe there's something wrong too.
If it's in the preview - could you please post the whole code here?
best,
Anton
![]() | Did my post help answer your query? Help the Community by marking it as a solution |
Jun 23, 2021 5:52 AM
Hi @JErkelens,
I've tried your code with "Default" as blog and I'm getting the correct URL.
Are you getting the .../blog/blog/... in the module preview or on the "live" page?
If it's in the live page - could you please check if you have something in the redirects? Maybe there is a /blog/ redirect set which collides. Also you can check your Blog settings(don't change anything - just check). maybe there's something wrong too.
If it's in the preview - could you please post the whole code here?
best,
Anton
![]() | Did my post help answer your query? Help the Community by marking it as a solution |
Jun 23, 2021 5:45 AM
Hey @JErkelens
Welcome to the Community and thank you for sharing this information.
Hey @piersg @stefen @Anton could you please advise @JErkelens?
Thanks
Sharon
![]() | ¿Sabías que la Comunidad está disponible en Español? ¡Participa hoy en conversaciones en el idioma de tu preferencia,cambiando el idioma en tus configuraciones! Did you know that the Community is available in other languages? Join regional conversations by changing your language settings ! |