CMS Development

suyen-rojas
Membre

Get Recent and Popular Posts Based on Language

Résolue

Hi everybody,

My team is creating the Spanish version of our website(currently in english only). 
I am using the multilanguage feature in husbpot, so I am creating all the pages groups with that.
My problem now is: I need to show the 5 most recent/popular posts of the blog in some of the pages, I am using the hubl functions blog_recent_posts('###', 5) and blog_popular_posts('##', 5).

How can I use those functions or any other, to get the top 5 corresponding to the language? Since the Blog id still the same in both laguages I haven't find a way to do that.

Any idea? Workaround? 

Thanks!

0 Votes
1 Solution acceptée
Gonzalo
Solution
Contributeur de premier rang | Partenaire solutions Diamond
Contributeur de premier rang | Partenaire solutions Diamond

Get Recent and Popular Posts Based on Language

Résolue

I suggest you to double check your setup, the ideal one would be to split the blog based on language, you will probably have some other issues on your HTML marktup regarding the multilingual setup, and if you are translating the posts you won't get auto-relation for canonical links.

 

Said that, for the current setup (not ideal) from the top of my mind I can think on using the `blog_popular_posts()` with a higher limit (if you use to translate most of your post 15 should be enough, otherwise you could go up to 20-30 to be safe).
Then you can loop the posts trying to filter by the language and displaying the most popular in one language only. Although I am not completely sure this can be done, because I believe the language setting cames from the blog itself and not from the post? But Hubspot added multilingual recently to the blog so I didn't had the time to double check about it.
While in a blog post use the developer info link to get the available variables to find something related to the language.

If this answer helps you to solve your questions please mark it as a solution.

Thank you,


Gonzalo Torreras

HubSpot freelance developer

hola@gonzalotorreras.com
www.gonzalotorreras.com
Schedule a meeting

Voir la solution dans l'envoi d'origine

2 Réponses
Gonzalo
Solution
Contributeur de premier rang | Partenaire solutions Diamond
Contributeur de premier rang | Partenaire solutions Diamond

Get Recent and Popular Posts Based on Language

Résolue

I suggest you to double check your setup, the ideal one would be to split the blog based on language, you will probably have some other issues on your HTML marktup regarding the multilingual setup, and if you are translating the posts you won't get auto-relation for canonical links.

 

Said that, for the current setup (not ideal) from the top of my mind I can think on using the `blog_popular_posts()` with a higher limit (if you use to translate most of your post 15 should be enough, otherwise you could go up to 20-30 to be safe).
Then you can loop the posts trying to filter by the language and displaying the most popular in one language only. Although I am not completely sure this can be done, because I believe the language setting cames from the blog itself and not from the post? But Hubspot added multilingual recently to the blog so I didn't had the time to double check about it.
While in a blog post use the developer info link to get the available variables to find something related to the language.

If this answer helps you to solve your questions please mark it as a solution.

Thank you,


Gonzalo Torreras

HubSpot freelance developer

hola@gonzalotorreras.com
www.gonzalotorreras.com
Schedule a meeting
dennisedson
Équipe de développement de HubSpot
Équipe de développement de HubSpot

Get Recent and Popular Posts Based on Language

Résolue

@Gonzalo , @Anton  do either of you have advice for @suyen-rojas ?

0 Votes