Skip to content

Instantly share code, notes, and snippets.

@msherstobitow
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save msherstobitow/195dec973b2ccea3c1a6 to your computer and use it in GitHub Desktop.
Save msherstobitow/195dec973b2ccea3c1a6 to your computer and use it in GitHub Desktop.
Adds ability to include any snippet with 4 lines in any template

Shopify snippet shortcode

Example

Some content text with [snippet_shorctode]

In any template

Save snippet content to a variable

{% capture snippet_shorctode %}{% include 'snippet_content' %}{% endcapture %}

Save page or anything else content to a variable

{% capture content %}{{ page.content }}{% endcapture %}

Replace content shorcode with snippet content

{% assign content = content | replace: '[feedback_form]', feedback_form %}

Render the content

{{ content }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment