You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I’m looking at the new computed data feature, and seems like it can help me greatly simplify my templates (and perhaps help improve build time as a result). However, I’ve come across an issue.
Given the following *.11tydata.js file in a directory:
module.exports={layout: 'article',permalink: '{{ page.date | date: "%Y/%m" }}/{{ page.fileSlug }}.html',eleventyComputed: {image: data=>{console.log(data.app);// data.app is populated by the global data file, app.js}}};
Logging data.app, I get the following output (simplified) in the console for each page in the directory:
{
title: 'Paul Robert Lloyd',
short_title: 'PRL',
description: 'The personal website of Paul Robert Lloyd'
}
However, if I update my *.11tydata.js file to log data.app.title, I get the following error:
Problem writing Eleventy templates: (more in DEBUG output)
> Cannot read property 'title' of undefined
This is weird, as that was previously shown as a property of app. Have I missed something?
The text was updated successfully, but these errors were encountered:
I’m looking at the new computed data feature, and seems like it can help me greatly simplify my templates (and perhaps help improve build time as a result). However, I’ve come across an issue.
Given the following
*.11tydata.js
file in a directory:Logging
data.app
, I get the following output (simplified) in the console for each page in the directory:However, if I update my
*.11tydata.js
file to logdata.app.title
, I get the following error:This is weird, as that was previously shown as a property of
app
. Have I missed something?The text was updated successfully, but these errors were encountered: