I tried accessing the built-in content variable in webc:setup, which stores the contents of the template for some manipulation/transformation, and got unexpected behavior.
---
layout: base.webc
---
<script webc:setup>
// some content processing, wrapping with <article> just for example
const processedContent = `<article>${content}</article>`;
// for a.md the content should be <h1>A content</h1>
// for b.md the content should be <h1>B content</h1>
// But for b.md the content is actually <h1>A Content</h1>
</script>
<div class="some-wrapper">
<slot @raw="processedContent"></slot>
</div>
I tried accessing the built-in
content
variable inwebc:setup
, which stores the contents of the template for some manipulation/transformation, and got unexpected behavior.I have this structure:
base.webc
child.webc
a.md
b.md
eleventy.config.js
But after build I have the same content for both templates:
_site/a/index.html
_site/b/index.html
It looks like the
content
variable is cached and uses the content of the first template every time.Windows 10 11ty/eleventy@2.0.1 11ty/eleventy-plugin-webc@0.11.2 Test repo