Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Adds js front matter type for arbitrary JavaScript front matter. #2819

@darthmall

Description

@darthmall

There’s an example of configuring a custom JavaScript format for frontmatter in the official demos. It adds functionality that is fairly similar to the component scripts in Astro.

It strikes me as something that might be nice to add to the pre-configured frontmatter formats that are shipped with Eleventy. But I have a couple of reservations as well…

First, based on the demo, it looks like it does add a dependency to core: node-retrieve-globals.

Second, there’s already the js format which allows you to specify frontmatter as a single JavaScript object. It’s not exactly the same as the javascript format in the demo, but it’s similar enough that I can imagine the difference being confusing. I’m not sure why a person might expect that js lets you define a single objects and javascript lets you write a script where all of the variable are exported to the template context.

Still, it’s not hard for me to imagine that this would be useful to people. I know a lot of people like the component scripts in Astro.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions