Blog 1

Random Talk on Random Thoughts

Include Liquid Code Inside Octopress Codeblocks

| Comments |

Last night, I wrote a post on editing a Ruby plugin file and an Atom Feed XML file for removing redundant images in Atom Feeds.1 To show how to change the files, I put some codeblocks in my post.

Sample codeblock that contains Liquid codelink
{% codeblock Change the XML file as well lang:xml %}
  <!-- other elements -->
  <content type="html"><![CDATA[{{ post.content | remove_linenumbers | remove_bigfig | expand_urls: site.url | cdata_escape }}]]></content>
{% endcodeblock %}

However, I couldn’t generate the site. I tried HTML encoding the contents and surrounding them using a <pre> tag, instead of a {% codeblock %} tag, but this approach also failed.

Walter could post some Liquid code, but there’s no source for his blog on GitHub, and he no longer uses Octopress anymore. Therefore, I viewed Clapper’s code since he wrote some Liquid template tags for installing an image popup plugin. In the blog post introducing his plugin, there’s a link that took readers to another post about how his use of Neiner’s jQuery table of contents plugin on Octopress. I studied the markdown source of the post, and saw that a {% raw %} tag was used to surround the interior of the codeblock which contained Liquid code.

  1. See My Settings for RSS (1) for details.