Skip to content

Instantly share code, notes, and snippets.

@stephpolinar
stephpolinar / metafield-key.liquid
Last active June 17, 2024 04:59
Makes use of user-inputted text to access metafields
<!-- 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]
@stephpolinar
stephpolinar / readmore-truncate.liquid
Last active June 17, 2024 05:22
A version of implementing a "Read more" button in collection descriptions
<!--
This is assuming that the paragraphs you want to truncate are enclosed in a span tag with ID="more"
(e.g. <span id="more"></span>)
-->
<!-- CSS -->
<style>
#more {
display: none;
}