Reputation: 1631
I'm trying to use GitHub Pages for my project's documentation, but it includes generated html files that turn out to have illegal liquid tags. I don't need any expansion beyond the _layout itself, but as far as I can tell, any {% ... %}
tags in the articles' content themselves are also evaluated and there seems to be no way to suppress this, other than adding {% raw %}...{% endraw %}
around the entire contents of every single article.
Is there any way to do this at the call site? Something along the lines of {{ content | unrendered }}
would be excellent.
Note: this seems to be the opposite problem to many others, who are using page.content
in a pre-render context and wanting it to be rendered; I've tried page.content
but as far as I can tell it's exactly the same in my case, so no dice.
Upvotes: 0
Views: 172
Reputation: 52809
page.content
was raw in the jekyll 2.x era. Now its rendered content.
You can use a hook plugin to add a page.raw
field on any page.
Jekyll::Hooks.register :pages, :pre_render do |document|
document.data['raw'] = document.content
end
If you want to do the same on posts and collections items, use a documents hook :
Jekyll::Hooks.register :documents, :pre_render do |document|
Note :
:pre_render
hooks document.content
contains raw content:post_render
hooks document.content
contains rendered contentUpvotes: 1