Comments (5)
Watch for eleventyComputed
11ty/eleventy#481 to drop soon in 0.11.0 that will solve all these problems in a much better way.
e.g.
---
pagination:
data: collections
size: 1
alias: tag
layout: layouts/home.njk
eleventyComputed:
title: Tagged “{{ tag }}”
permalink: "/tags/{{ tag }}/"
---
and
<title>{{ title or metadata.title }}</title>
from eleventy-base-blog.
title: {{ tag }}
...strangely results in [object Object]
, despite {{ tag }}
showing up as the tag text in the body text, and {{ tag }}
expanding as expected in the permalink:
frontmatter. Any idea what's up?
from eleventy-base-blog.
Hmm… I suppose it is a bit unexpected that title: {{ tag }}
would not render there. permalink
is one of the only front matter keys that does render in the local template engine.
I suppose, technically Eleventy could loop through each front matter variable and attempt to render each value individually. But we’d need to create a dependency graph of front matter variables there, to ensure we rendered in the correct order. That being said, we don’t do any of this right now.
We only render permalink
and I think one other undocumented case. We do expose a renderData
object in front matter that does render the content inside of it. It was undocumented because I wasn’t really happy about it.
For example, if the tags.njk
template had this front matter:
---
pagination:
data: collections
size: 1
alias: tag
layout: layouts/home.njk
renderData:
title: Tagged “{{ tag }}”
permalink: /tags/{{ tag }}/
---
and the layout title were changed to:
<title>{{ renderData.title or title or metadata.title }}</title>
This works as expected. I will make that change but this will cement renderData forever and now I’m a little sad 😇
I am open to more complicated-behind-the-curtain solutions here, if you have suggestions!
from eleventy-base-blog.
I think the reason I’m not real happy about renderData
is that I’m not even sure if you can use it inside of permalink
or vice versa. You get into weird cases where order matters.
from eleventy-base-blog.
This is now resolved. Thanks! I’m closing the issue.
from eleventy-base-blog.
Related Issues (20)
- _data/eleventy.json? or eleventy.js? HOT 1
- Dynamic content inside {% image %} shortcode? HOT 2
- Auto posting to social media HOT 3
- Eleventy-img plugin causing build error? HOT 1
- Simplify getAllTags filter? HOT 3
- Questions regarding eleventy-img config HOT 3
- PrismJS error HOT 2
- Unclear how to configure to be compatible with CSP directive `style-src 'self'` HOT 1
- Draft tags show up in tag pagination even when excluding drafts HOT 1
- How to put RSS feed at /feed ? HOT 3
- How to transform tags to lowercase and sort alphabetically? HOT 1
- Support for animated gifs? HOT 3
- Generating a new blog post?
- Footnote support
- Error reported when tag is in Chinese HOT 4
- How can I show the 10 latest posts instead of 3 in the home page? HOT 2
- .editorconfig's use of tabs instead of spaces causes eleventyNavigation to fail HOT 4
- why are the tags title case HOT 1
- Should be clear that permalink and excludeFromCollections are at the mercy of downstream logic
- Inconsistency between documentation and implementation for "draft" feature
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eleventy-base-blog.