I am using Jekyll to post blogs. When I write "{%...%}" in my markdown files, it seems that the "{%...%}" will be parsed by Liquid. But sometimes that is not what I want, and may cause errors. So what's the proper way to include texts like "{%...%}" in my post content(the .md file)?
I checked the Liquid docs and learned I can use the Block Tag {% raw %} ... {% end raw %}
to include raw text between. However, I don't think this a good idea. Because if the markdown file was not parsed by Liquid (e.g., in some environment other than Jekyll), this will leave unused {% raw %} in my text.
Correct me if I said something wrong.
P.S.: I use GitHub Pages for hosting and they disable plugins.
Jekyll supports Markdown in addition to HTML when building pages. Markdown is a great choice for pages with a simple content structure (just paragraphs, headings and images), as it's less verbose than raw HTML.
This is where the generated site will be placed (by default) once Jekyll is done transforming it.
Create /assets/images/ in the root of your project and place the image there. And if you're not hosting with GitHub Pages you can use the Jekyll Post Files plugin which allows you to organize your images alongside your posts. Don't use underscores in your folder names.
One thing to remember about Jekyll and GitHub pages is that you can always build your site locally (by running jekyll build
), commit it to your repo and have GitHub serve it from there. So you can use (or create) a plugin that'll enable you to have what you want. :P
On the other hand, I think it's really too much trouble to not use the {% raw %}
. If -- and only if -- you're going to use these markdown files somewhere else, you can pass them through a script (or a sed
command) and sweep away these tags.
You could use HTML entities {
and }
for {
and }
. Not the tidiest but it doesn't use {% raw %}
or rely on plugins.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With