Skip to content

Access global data from a directory data file #3030

Answered by puleddu
puleddu asked this question in Q&A
Discussion options

You must be logged in to vote

Trying to answer my own question, it seems like the following is a viable option:

about.11tydata.js

module.exports = {
  eleventyComputed: {
    about: data => data.snippets
  }
};

Now, the data in about is available for use in my templates, such as about.md.
I wonder if it's also the easiest, most efficient way do do something like this.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@pdehaan
Comment options

pdehaan Aug 30, 2023
Collaborator

Answer selected by puleddu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants