Created
February 25, 2021 11:24
-
-
Save atikju/90a3aa34666ed5f51998a576583132ba to your computer and use it in GitHub Desktop.
Show related articles based on article tags - Shopify
Apologies, the code is in fact working with multiple tags. The inconsistent results I'm getting are most likely related to errors in my own theme, rather than with this code. Thanks again for your help!
I think I understand your suggestion, tried and it didn't work. When an article has multiple tags it simply isn't displaying anything. It might be because the tags aren't 'split', and it's outputting the full string (ex: tag1tag2tag3).
Thank you, sir!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The original code will loop through all the tags of the article and pull out related articles with contain those tags - tag by tag, most likely in alphabetical order (not checked). The loop checking is limited by the
counter
variable. I suspect if you increase that value, it will have more time to loop through all tags before hitting the limit and stop checking.The code has no 'weight' to article tags or preference other than (I assume) looping in alphabetical order through all article tags. If you think it's also missing articles, it may be hitting the pagination limit before finding them (if you have a lot of blog articles?).