Skip to content

RFC: Support slot attributes and data cascade #16

@giuseppeg

Description

@giuseppeg

⚠️ this feature is related to the Collections proposal and probably should be implemented before #17.

slot attributes

Currently xm support only element slots:

<slot name="title"></slot>

We should add support for slot attributes:

<a slot:href="https://{domain}/contact">contact me</a>

These will be filled with fill elements eg:

<fill name="domain">acme.com</fill>

spec

Any attribute can be slotted if prefixed with slot:. Within the value for the attribute there can be multiple expressions delimited with { and }. The expression name matches a fill name, and xm replaces the expression with the fill value.

Data Cascade

xm should allow to define multiple sources for data, including a global data object that is provided via config file.

We need to rework the main plugin to merge the data correctly using a Data Cascade mechanism similar to the 11ty's one. Check out https://www.11ty.dev/docs/data-cascade/

Additionally we need to provide a global xm:permalink fill value that contains the absolute path for the file so that people can use it to reference to the current page (eg. when creating sharing links). The xm: namespace will be reserved for xm fill values.

Metadata

Metadata

Assignees

No one assigned

    Labels

    RFCrequest for commentshelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions