giuseppeg / giuseppeg/xm

RFC: Support slot attributes and data cascade

Open
#16 0 comments 0 reactions 0 assignees View on GitHub
help wanted RFC
Dominant language
JavaScript
Stars
323
Forks
9
PR merge metrics
No merged PRs in 30d

Description

⚠️ **this feature is related to the [Collections proposal](https://github.com/giuseppeg/xm/issues/17) and probably should be implemented before #17**.

## slot attributes

Currently xm support only element slots:

```html

```

We should add support for slot attributes:

```html
contact me
```

These will be filled with fill elements eg:

```html
acme.com
```

### 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](https://github.com/giuseppeg/xm/tree/master/lib/posthtml-xm-import) 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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.