user3094719
user3094719

Reputation: 297

How to replace a string in a page with Jekyll before running liquid

I have a page xyz.replaceme in my root directory and it is markdown formatted like so..

---
layout: post
title:  "xyz"
date:   2015-01-12 15:21:30
categories: xyz
---

{{ xyz }}

I want to replace {{ xyz }} with another string, convert the file to .md and have it rendered like every other page. I'm trying to do this via _plugins/converters.rb but it just isn't working.

class xyz < Converter
    priority :high
    safe true
    def matches(ext)
      ext =~ /^\.replaceme$/i
    end
    def output_ext(ext)
      ".md"
    end
    def convert(content)
      content.gsub('{{ xyz }}', 'abc')
    end
  end

What am I doing wrong?

Upvotes: 1

Views: 735

Answers (1)

CAnicaTA
CAnicaTA

Reputation: 11

The liquid output markup {{ xyz }} only works with a YAML front-matter.

Upvotes: 1

Related Questions