Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An example of an eleventyComputed.js global data file #1104

Closed
anaurelian opened this issue Apr 17, 2020 · 3 comments
Closed

An example of an eleventyComputed.js global data file #1104

anaurelian opened this issue Apr 17, 2020 · 3 comments

Comments

@anaurelian
Copy link

On the Computed Data | Eleventy, a simpler static site generator. page, in the Advanced Details section, related to

You can put eleventyComputed anywhere in the Data Cascade: Front Matter, any Data Files (you could even make an eleventyComputed.js global data file if you wanted to set this for your entire site).

I think it would be helpful to add an example of such a file, similar to the posts/posts.11tydata.js example:

module.exports = {
  eleventyNavigation: {
    key: data => data.title,
    parent: data => data.parent
  }
};

(no need to add eleventyComputed: after module.exports, because the file name is already eleventyComputed.)

This may prevent silly mistaked like this one.

@zachleat
Copy link
Member

I like this idea—do you have the bandwidth to PR it? There are “Edit this page” links on the bottom of each docs page.

@Snugug
Copy link
Contributor

Snugug commented Apr 29, 2020

I've opened a PR to add an example:

11ty/11ty-website#558

@zachleat
Copy link
Member

Fixed by 11ty/11ty-website#558

Thanks @Snugug!

Computed Data (eleventyComputed) automation moved this from To Do to Done Apr 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

No branches or pull requests

3 participants