Open kenmorechalfant opened 1 year ago
I don’t know that I would expect a <slot webc:if>
to control whether the host component renders or not.
This is likely a bit more confusing as this is an HTML-only component: https://www.11ty.dev/docs/languages/webc/#html-only-components
That said, I would expect webc:if
on a webc:root
to do this. https://www.11ty.dev/docs/languages/webc/#attributes-and-webcroot
<template webc:root="override" webc:if="isLang(lang,is)"><slot></slot></template>
Produces:
<h1>Hola!</h1>
<h1>Hello!</h1>
<template><h1>Bonjour!</h1></template>
Adding webc:nokeep
:
<template webc:nokeep webc:root="override" webc:if="isLang(lang,is)"><slot></slot></template>
Produces:
<h1>Hola!</h1>
<h1>Hello!</h1>
<h1>Bonjour!</h1>
How do I prevent automatic slot insertion without any output?
Output (e.g. meta.locale.lang === 'fr'):
Instead of the expected output:
If I add the following line to the end of
is-lang.webc
, it looks visually correct, but of course, outputs unnecessary markup.Outputs:
I believe
webc:if
should be respected onslot
s so the redundant inverted "if" is not needed.