Set title in nunjucks pages from queried data #2542
Replies: 2 comments 17 replies
-
|
If you're setting the My only immediate idea would be the module.exports = {
eleventyComputed: {
title: data => data.artist.title + ' - ' + data.artist.date
}
}Do you have a public repo somewhere or any chance you can tell me what the |
Beta Was this translation helpful? Give feedback.
-
|
Thanks @pdehaan! This was it!It was sort of it |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I can't seem to figure out how to do this and its seems like I'm missing something very obvious.
I am pulling in data from graphql query and creating pages from that. I want the title to be the concatenation of two elements in my object, title and date.
I can't figure out where to do this. Here's my template file
artist.njk:My understanding (which seems wrong right now) is that I would make an 11tydata file to process this, like so
artist.11tydata.js:and then in the
artist.njkfront matter I would add:but that results in this error:
TypeError: str.replace is not a function (via Template render error)How would you go about doing this? Thanks!
Beta Was this translation helpful? Give feedback.
All reactions