CMS Development

JErkelens
Member

popular blog post rendering an invalid url

SOLVE

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?

0 Upvotes
1 Accepted solution
Anton
Solution
Key Advisor | Diamond Partner
Key Advisor | Diamond Partner

popular blog post rendering an invalid url

SOLVE

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




check
Did my post help answer your query? Help the Community by marking it as a solution



View solution in original post

2 Replies 2
Anton
Solution
Key Advisor | Diamond Partner
Key Advisor | Diamond Partner

popular blog post rendering an invalid url

SOLVE

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




check
Did my post help answer your query? Help the Community by marking it as a solution



sharonlicari
Community Manager
Community Manager

popular blog post rendering an invalid url

SOLVE

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 !


0 Upvotes