Created
October 24, 2023 10:10
-
-
Save pkcpkc/57cc48e90796fdd955785146932e363a to your computer and use it in GitHub Desktop.
liquid-intersection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% comment %}Input from article{% endcomment %} | |
{% assign articleTopics = "t3,t4,t5" | split: "," %} | |
{% assign articleAuthors = "a1,a2" | split: "," %} | |
{% comment %}This will come from user.topics, user.authors{% endcomment %} | |
{% assign userTopics = "t1,t3,t5" | split: "," %} | |
{% assign userAuthors = "a2,a4" | split: "," %} | |
{% for userTopic in userTopics %} | |
{% if articleTopics contains userTopic %} | |
{% assign topicsIntersection = topicsIntersection | concat: userTopic %} | |
{% endif %} | |
{% endfor %} | |
{% if topicsIntersection.size > 0 %} | |
Push-Thema: {{topicsIntersection.first }} | |
{% else %} | |
{% for userAuthor in userAuthors %} | |
{% if articleAuthors contains userAuthor %} | |
{% assign authorsIntersection = authorsIntersection | concat: userAuthor %} | |
{% endif %} | |
{% endfor %} | |
Push-Autor: {{authorsIntersection.first}} | |
{% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment