Skip to content

renderTemplate not rendering liquid inside variable #3152

Answered by pdehaan
imalb-prs asked this question in Q&A
Discussion options

You must be logged in to vote

As far as I know, Liquid/Eleventy won't recursively process the strings, so key won't be re-parsed to turn the front matter string into a parsed thing.

You can probably get around that using a custom filter which will parse the template though:

// eleventy.config.js
const { EleventyRenderPlugin } = require("@11ty/eleventy");
const { Liquid } = require("liquidjs");

/**
 * @param {import("@11ty/eleventy/src/UserConfig")} eleventyConfig
 * @returns {ReturnType<import("@11ty/eleventy/src/defaultConfig")>}
 */
module.exports = function (eleventyConfig) {
  eleventyConfig.addPlugin(EleventyRenderPlugin);

  eleventyConfig.addFilter("liquidify", function (input, ctx = {}) {
    const engine = new 

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@imalb-prs
Comment options

@pdehaan
Comment options

@pdehaan
Comment options

@imalb-prs
Comment options

Answer selected by imalb-prs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants