CMS Development

JErkelens
Membre

popular blog post rendering an invalid url

Résolue

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 Votes
1 Solution acceptée
Anton
Solution
Expert reconnu | Partenaire solutions Diamond
Expert reconnu | Partenaire solutions Diamond

popular blog post rendering an invalid url

Résolue

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

Anton Bujanowski Signature

Voir la solution dans l'envoi d'origine

2 Réponses
Anton
Solution
Expert reconnu | Partenaire solutions Diamond
Expert reconnu | Partenaire solutions Diamond

popular blog post rendering an invalid url

Résolue

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

Anton Bujanowski Signature
sharonlicari
Gestionnaire de communauté
Gestionnaire de communauté

popular blog post rendering an invalid url

Résolue

Hey @JErkelens 

 

Welcome to the Community and thank you for sharing this information. 

 

Hey @piersg @stefen @Anton could you please advise @JErkelens

 

Thanks

Sharon


Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings !




0 Votes