Skip to content

Automatically named objects from *.11tydata.js files #2996

Closed Answered by pdehaan
stuffnting asked this question in Q&A
Discussion options

You must be logged in to vote

https://github.com/pdehaan/11ty-2996

<!-- ./src/pages/index.liquid -->
global: <pre>{{ myData1 | json }}</pre>
local: <pre>{{ myData2 | json }}</pre>
// ./src/_data/myData1.js
module.exports = [
  "global1",
  "global2"
];
// ./src/pages/pages.11tydata.js
module.exports = {
  myData2: [
    "local1",
    "local2"
  ],
};

OUTPUT

global: <pre>["global1","global2"]</pre>
local: <pre>["local1","local2"]</pre>

Replies: 1 comment 1 reply

Comment options

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

Answer selected by stuffnting
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