Last active
June 17, 2024 04:59
-
-
Save stephpolinar/013d5160aa87024562d15ad27823c2e9 to your computer and use it in GitHub Desktop.
Makes use of user-inputted text to access metafields
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
<!-- Metafield list --> | |
{%- liquid | |
assign image_key = section.settings.image | downcase | replace: " ","_" | |
assign image = article.metafields.my_fields[image_key].value | |
assign title_key = section.settings.title | downcase | replace: " ","_" | |
assign title = article.metafields.my_fields[title_key] | |
assign text_key = section.settings.text | downcase | replace: " ","_" | |
assign text = article.metafields.my_fields[text_key] | |
assign caption_key = section.settings.caption | downcase | replace: " ","_" | |
assign caption = article.metafields.my_fields[caption_key] | |
-%} | |
<!-- e.g. section.settings.image is of type 'Text' in the schema --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment