在文档(https://www.11ty.dev/docs/data-global-custom/)中,它声明可以使用以下选项添加自定义全局数据:
// .eleventy.js
module.exports = function(eleventyConfig) {
eleventyConfig.addGlobalData("myFunctionPromise", () => {
return new Promise((resolve) => {
setTimeout(resolve, 100, "foo");
})
});
};当试图在.eleventy.js项目配置文件中使用它时,它会失败:
> eleventyConfig.addGlobalData is not a function但是,可以在eleventyConfig上使用eleventyConfig.addCollection定义自定义集合,而不会出现任何问题。
这里有什么问题?
https://stackoverflow.com/questions/67897079
复制相似问题