Hi, I'm wondering where I've went wrong trying to implement the related posts HubL on my site. What I need is for up to 6 related blog posts to populate automatically on a single blog post, based on that posts' tags. It should be able to use the post tags, and pull in other related blog posts. I've created a module, but nothing is being pipulated at this time. Here's my code:
Whenever you are within a HubL declaration ( {% ... %} ), you do not need to use {{ }} to reference HubL variables, you can just write the variables without the {{ }}. Also the 'limit' attribute value does not need to be in quotes:
Okay, at least we've ruled out the syntax causing the issue...
Looking at the blog ID you're using, this is me grasping at straws, but I'm wondering if that's not the correct ID? Usually I'd expect it to be a longer number like '5900440271'. For reference, the ID of a blog can be found in the URL of the blog dashboard:
Additionally, you're assigning the 'tagNames' variable the value of 'content.tag_names' - if you are not viewing this module in the context of a blog post (previewing the module in the design manager, for example), this variable would not be set properly.
Hopefully this gets us a bit further, let me know if I need to clarify anything.
The blog post ID fixed one issue - so now it is pulling in the correct posts, however, it isn't using the macro that I set and it's just using the default markup when it prints the related posts.
I wonder if the tag is rejecting your macro and falling back to using the default formatter, because it is unable to call your macro using the 'index' and 'count' arguments.