Created
September 21, 2020 18:26
-
-
Save junaidkbr/802b477adf44d2b0c941ad011daf7925 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 %} | |
Logic to ignore a tag in the loop, based on a provided set of comma separated tags. | |
@param settings.ignore_tags Comma separated tags to ignore | |
{% endcomment %} | |
{% liquid | |
assign can_ignore_tag = false | |
assign tag_handle = tag | handle | |
assign tags_to_ignore = settings.ignore_tags | split: ',' | |
for ignore_tag in tags_to_ignore | |
if ignore_tag contains '*' | |
assign ignore_tag_trimmed = ignore_tag | replace: '*', '' | trim | |
assign parts = tag_handle | split: ignore_tag_trimmed | |
if parts[0] == blank | |
assign can_ignore_tag = true | |
break | |
endif | |
else | |
assign ignore_tag_trimmed = ignore_tag | trim | |
if tag_handle == ignore_tag_trimmed | |
assign can_ignore_tag = true | |
break | |
endif | |
endif | |
endfor | |
if can_ignore_tag | |
continue | |
endif | |
%} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment