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
1
2
3
4
5
6
{% codeblock Change the XML file as well lang:xml http://www.ewal.net/2012/09/08/octopress-customizations/#categories-in-the-atom-feed %}
<entry>
  <!-- other elements -->
  <content type="html"><![CDATA[{{ post.content | remove_linenumbers | remove_bigfig | expand_urls: site.url | cdata_escape }}]]></content>
</entry>
{% 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. 

Comments