Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document renderData feature. #33

Closed
zachleat opened this issue Sep 19, 2018 · 10 comments
Closed

Document renderData feature. #33

zachleat opened this issue Sep 19, 2018 · 10 comments

Comments

@zachleat
Copy link
Member

zachleat commented Sep 19, 2018

Related: 11ty/eleventy#216 11ty/eleventy#236

More info at 11ty/eleventy-base-blog#15

@zachleat zachleat transferred this issue from 11ty/eleventy Nov 21, 2018
@zachleat
Copy link
Member Author

zachleat commented Dec 7, 2018

also 11ty/eleventy#315 and maybe 11ty/eleventy#329 ?

@zachleat
Copy link
Member Author

zachleat commented Dec 7, 2018

I’ve been reluctant to document this as I think a better idea for this will crop up and I’m waiting for inspiration 😇

@LandonSchropp
Copy link

LandonSchropp commented Feb 13, 2019

@zachleat Is there any update on this? I'm working on a simple notes site and I'm trying to set up a standard description in my note.njk layout file.

layout: layouts/default.njk
description: These are my personal notes on {{ title }} by {{ author }}.

I tried a few different variables of renderData and I could see the values, but I couldn't get any variables to render.

layout: layouts/default.njk
renderData:
  description: These are my personal notes on {{ title }} by {{ author }}.

@LandonSchropp
Copy link

LandonSchropp commented Feb 13, 2019

I’ve been reluctant to document this as I think a better idea for this will crop up and I’m waiting for inspiration 😇

This is just my 2¢, but would anything really bad happen if you just turned on interpolation by default in the front matter. Is anyone really including curlys in those values that they don't want to be interpolated?

Maybe I'm missing something here, but it seems to me like the easiest thing would be to turn interpolation on by default and allow people to escape {{}}'s if they don't want that behavior.

@paulshryock
Copy link

paulshryock commented Mar 6, 2019

Maybe I'm missing something here, but it seems to me like the easiest thing would be to turn interpolation on by default and allow people to escape {{}}'s if they don't want that behavior.

I second this.

Although maybe a non-breaking change (if any hypothetical person was already using curly braces as content in front matter) would be an option in the Eleventy config file, which is disabled by default?

@danfascia
Copy link

This would be really useful so I will third it!

@braco
Copy link

braco commented Apr 7, 2019

Maybe I'm missing something here, but it seems to me like the easiest thing would be to turn interpolation on by default and allow people to escape {{}}'s if they don't want that behavior.

There's no way to get a dynamic, data driven title from pagination right now? That's... a surprisingly large missing feature

@LandonSchropp
Copy link

@braco I managed it like this, but I wish there was a better way:

{% set title = title or pagination.items[0].title %}

@zachleat
Copy link
Member Author

Closing this in lieu of new Computed Data feature. Follow along at 11ty/eleventy#481

@openmindculture
Copy link

{% set title = title or pagination.items[0].title %}

@LandonSchropp @braco @zachleat Where to put this code to make it actually override the front matter definition?
I have

---
permalink: "auditees/{{ auditee.title | slug }}/"
title: {{ auditee.title }}
---
{% set title = auditee.title %}

still the rendered page title is {{ auditee.title }} without any interpolation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

No branches or pull requests

6 participants