sjifire / website

main website for sjifire.org
MIT License
1 stars 0 forks source link

run src/data files through nunjucks? #97

Open skippy opened 2 years ago

skippy commented 2 years ago

right now, anything that is stored in 11ty data files are not run through nunjucks; this means variables within other data files, such as stats.json and configs.json aren't available.

I ran into this issue but was able to work around for now, but do we need this?

skippy commented 2 years ago

here is some code that sets it up right but the {{configs.site_name}} is stripped out of the raw string somewhere in the pre-processing step.

  const mdRender = require('markdown-it')({linkify: true})
  .use(require('markdown-it-attrs'));
  const nunjucks = require('nunjucks')

  eleventyConfig.addFilter("markdownify", function(rawString) {
    let str = nunjucks.renderString(rawString, this.ctx);
    return mdRender.render(str);
  });
skippy commented 2 years ago

another place this comes up is on the burn-permits page, where we show configurable dates within the yml template