Show the List of "Related articles" based on the Campaign
Hi there!
As the title suggest I'm trying to show the list of "Related articles" based on the Campaign on the Blog Post page but I'm having some trouble figuring out how to do that.
So for example, I have this campaign named Tutorial. If I open a blog post in that campaign it should display maximum six related blog posts. If there aren't any related articles then I want to show the most popular articles in that Topic
So in short, Total six related articles in the same campaign. If not available then most popular articles in the same topic.
Currently, I'm displaying articles based on the Topic. The code for it looks something like this.
For items inside of a campaign, there should be a HubL variable called {{ content.campaign_name }} that you can use. This would return the campaign name that is assigned.
Your code should then have the following added in:
With this, you would have to make sure your campaign name is the same as your topic name or it won't pull anything. Also, wrapping it all in an if statement helps with fallback just in case.