Summary
There appears to be a mismatch between current inline HTML component behavior and the documentation around component/template-data access.
In practice, inline HTML custom components appear to receive attribute/prop data only, while several docs pages imply that template data such as page metadata, YAML data, collections, and parsed content structure are available directly inside components.
This issue is meant to capture the design question and the documentation gap before deciding whether to change implementation.
Observed Current Behavior
When using an inline HTML custom component such as:
and defining the component in an HTML library like:
<nav :is="breadcrumbs">
<li aria-current="page">{ title }</li>
</nav>
page data like title, dir, slug, etc. do not appear to be available automatically inside the component instance.
However, if values are passed explicitly as attributes/props, they do work:
<breadcrumbs url="{ dir }" title="{ title }" />
or, likely more idiomatically:
<breadcrumbs :url="{ dir }" :title="{ title }" />
Why This Is Surprising
The following docs suggest broader data availability:
layout-system.md
template-data.md
interactive-components.md
nuemark-syntax.md
In particular, interactive-components.md says components receive data from YAML files, page front matter, collections, and parsed content structure.
template-data.md also shows breadcrumb/navigation examples using dir and slug as if they are directly available in component/template context.
Important Distinction: Regular Attributes vs Colon Attributes
A useful nuance that should be documented clearly:
- Regular dynamic attributes like
title="{ title }" pass the evaluated value into the component and render that attribute into the DOM.
- Colon attributes like
:title="{ title }" pass the evaluated value as component data without rendering the prop as a DOM attribute.
This is useful and worth documenting whether or not implementation changes.
Design Question
Should inline HTML custom components automatically inherit template data, or should they remain attribute-prop driven by design?
Arguments for keeping current behavior
- Clearer component boundaries
- Lower collision risk between component props and page/template data
- Easier reasoning about where component values come from
- Better alignment with explicit data flow
- Nue performance is a primary feature of the framework, so any broad context inheritance should be evaluated carefully for overhead and repeated merge costs
Arguments for changing behavior
- Better alignment with current documentation/examples
- More convenient authoring for small shared components
- More consistent expectations with layout/template rendering and Nuemark examples
Main Risks if Implementation Changes
- Regressions from name collisions, especially keys like
title, description, dir, slug, url, headings, collection names, etc.
- Ambiguity around precedence between explicit props and inherited data
- Possible performance penalty if large template contexts are copied/merged into many component instances
- Loss of explicitness in component APIs
Possible Paths Forward
Option 1: No implementation change
Keep inline HTML custom components attribute-prop driven and update docs to state that clearly.
This would also be a good place to document the difference between regular attributes and colon attributes.
Option 2: Inherit template data directly
Make inline HTML custom components automatically inherit page/template data in addition to explicit props.
If this is done, prop precedence should likely remain:
- explicit component props/attributes
- inherited template data
Option 3: Inherit template data under a namespace
To reduce collision risk, inherited ambient data could be exposed under a namespace such as:
page.title
page.dir
page.slug
or
data.title
data.dir
data.slug
This may preserve convenience while minimizing collisions, though it would add a second access model and would require documentation updates.
Recommendation
If implementation is not changed now, the docs should be updated to reflect current behavior and explicitly document:
- inline HTML components are prop-driven
- regular attributes vs colon attributes
- when to pass page/template data explicitly
If implementation is changed later, the collision and performance implications should be tested carefully because framework performance is a core Nue value.
Summary
There appears to be a mismatch between current inline HTML component behavior and the documentation around component/template-data access.
In practice, inline HTML custom components appear to receive attribute/prop data only, while several docs pages imply that template data such as page metadata, YAML data, collections, and parsed content structure are available directly inside components.
This issue is meant to capture the design question and the documentation gap before deciding whether to change implementation.
Observed Current Behavior
When using an inline HTML custom component such as:
and defining the component in an HTML library like:
page data like
title,dir,slug, etc. do not appear to be available automatically inside the component instance.However, if values are passed explicitly as attributes/props, they do work:
or, likely more idiomatically:
Why This Is Surprising
The following docs suggest broader data availability:
layout-system.mdtemplate-data.mdinteractive-components.mdnuemark-syntax.mdIn particular,
interactive-components.mdsays components receive data from YAML files, page front matter, collections, and parsed content structure.template-data.mdalso shows breadcrumb/navigation examples usingdirandslugas if they are directly available in component/template context.Important Distinction: Regular Attributes vs Colon Attributes
A useful nuance that should be documented clearly:
title="{ title }"pass the evaluated value into the component and render that attribute into the DOM.:title="{ title }"pass the evaluated value as component data without rendering the prop as a DOM attribute.This is useful and worth documenting whether or not implementation changes.
Design Question
Should inline HTML custom components automatically inherit template data, or should they remain attribute-prop driven by design?
Arguments for keeping current behavior
Arguments for changing behavior
Main Risks if Implementation Changes
title,description,dir,slug,url,headings, collection names, etc.Possible Paths Forward
Option 1: No implementation change
Keep inline HTML custom components attribute-prop driven and update docs to state that clearly.
This would also be a good place to document the difference between regular attributes and colon attributes.
Option 2: Inherit template data directly
Make inline HTML custom components automatically inherit page/template data in addition to explicit props.
If this is done, prop precedence should likely remain:
Option 3: Inherit template data under a namespace
To reduce collision risk, inherited ambient data could be exposed under a namespace such as:
page.titlepage.dirpage.slugor
data.titledata.dirdata.slugThis may preserve convenience while minimizing collisions, though it would add a second access model and would require documentation updates.
Recommendation
If implementation is not changed now, the docs should be updated to reflect current behavior and explicitly document:
If implementation is changed later, the collision and performance implications should be tested carefully because framework performance is a core Nue value.