How to Filter Popularity Results by Section with Clavis
You can consume the Popularity endpoint and specify a section to which the retrieved articles should belong to. This can be used to populate a most popular list on Section fronts.
How to Use
We’ve updated both Clavis’ SDK and API to consider this new feature, adding a new parameter section to specify the section of the recommended articles.
Notice that if you have a section called /sports
for an article in Composer, you can filter by that section by just passing “sports” as the section. Likewise, if the section in Composer is called /sports/basketball/nba
, the articles belonging to that section will be included if you pass sports
as the section. That’s because Clavis filters checking if the provided section string is contained in the article’s section string. For this example and in terms of regular expressions, the regular expression would be /sports/
.
SDK Update
Now, recommendationsByPopularity admits one additional parameter, section
, that can be used as follows (limit, section)
clavis.recommendationsByPopularity(3, “sports”)
API Update
Same as in the SDK, using Clavis API you can specify the section of the Popularity recommendations:
/clavis/training/site/[sitename]/documents/recommendations?section=sports