title: Parsing Liquid in a Jekyll generator before converting to JSON
body: <p>Best to start by saying that I am very new to Ruby and Liquid. I have searched around looking for some resource on this issue, but as yet haven't been able to find anything of real use.</p>
  
  <p>I have a Jekyll site, which utilises the HTML5 History API. I have a Jekyll generator plugin which creates a single JSON file which holds all the post and page content, ready for use with HTML5 PushState and PopState. This part is functioning properly and is tested.</p>
  
  <p>My problem comes when I have a post/page on the site which has Liquid tags in it. I am guessing I need to parse these Liquid tags to get the template output before I create my JSON object for each post/page. Here is what I have for pages as an example:</p>
  
  <pre><code># Iterate over all pages
  site.pages.each do |page|
  
  # Encode the page HTML content to JSON
  link = page.url
      @content = Liquid::Template.parse(page.content)
      hash[link] = { "body_class" =&gt; page.data['body_class'], "content" =&gt; converter.convert(@content.render), "title" =&gt; '&lt;h1&gt;' + page.data["content_title"] + '&lt;/h1&gt;' }
  end
  </code></pre>
  
  <p>Now, this at the minute is basically removing all Liquid tags from the generated JSON file, leaving nothing in it's place.</p>
  
  <p>Here is my full generator file on <a href="https://github.com/Huskie/darrenhuskie.com/blob/master/_plugins/generate_json.rb" rel="nofollow">Github</a> which is based very heavily on <a href="https://github.com/jezen/jekyll-backbone" rel="nofollow">nice work by Jezen Thomas</a>.</p>
  
  <p>The output JSON file is also in that repo with the site, or can be accessed quickly <a href="https://github.com/Huskie/darrenhuskie.com/blob/master/_site/content/content.json" rel="nofollow">here</a>. The blog.html content is the last item in the JSON file and shows the empty h1 and div tags which should have content.</p>