Jekyll Liquid Syntax Error
Introduction
When I was writing this previous post, I faced a jekyll syntax error. I am currently writing my posts using the Minimal Mistakes Jekyll Theme; and I faced the “Liquid Exception: Liquid syntax error: Unknown tag ‘some_tag’ in post_file_directory”.
Reason
In this previous post, I talked about html features provided by django. Like this:
{%load static%} #This
{%include "navbar.html"%} #Or this
The problem was that the Jekyll Liquid engine mistakenly treated the {% django-stuff %} as Jekyll tags, even when they were enclosed within the ”```“ code blocks. Since these tags are specific to django and cannot be understood by the Jekyll engine, it resulted in a build failure.
Solution 1
If you search this issue up in google, or ask Chat-GPT like I did, the solutions would be to add
{% raw %} and {% endraw %} tags before the code. Like this:
{% raw %}
djang-stuff-code
{% endraw %}
Solution 2
However, that didn’t work for me. Instead, I had to add
[//]: # {% raw %}
and
[//]: # {% endraw %}
tags instead.
Solution 3
Or, you can just simply use corresponding HTML entities.
{as{,- and
}as}
{% raw %} = {% raw %}
Conclusion
The original solution might work just fine for you, but if it doesn’t, it’s certainly worth to try out my solution.