[英]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.. 我的根目录中有一个页面
xyz.replaceme
,它的markdown格式如下:
---
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. 我想用另一个字符串替换
{{ xyz }}
,将文件转换为.md
并使其像其他页面一样呈现。 I'm trying to do this via _plugins/converters.rb
but it just isn't working. 我正在尝试通过
_plugins/converters.rb
进行此操作,但它无法正常工作。
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? 我究竟做错了什么?
液体输出标记{{ xyz }}
仅适用于YAML前端。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.