eleventy
eleventy copied to clipboard
eleventyComputed not working after 2.0.0-canary.8
I've just upgraded to 2.0.0-canary.14 from 1.0.1. Almost everything worked great except my tag page.
---
pagination:
data: collections
size: 1
alias: tag
permalink: /tag/{{ tag | slug }}/index.html
eleventyComputed:
title: "{{ tag | title }}"
---
<header class="tag">
<h1>{{ title }}</h1>
</header>
I use eleventyComputed
and a filter to recondition the lowercase tags into something more readable. I do it here so I can use it in the <title>
tag and OG metadata, as well as on the page.
After upgrading, this doesn't work. title
is just empty. I've seen a post on another bug suggesting this crept in 2.0.0-canary.9 but I can't see anybody else having this problem.
I'm having the same problem with eleventyComputed
returning an empty string while paginating
title: GenericTitle
pagination:
data: collections
size: 1
alias: tag
permalink: /tags/{{ tag }}/
eleventyComputed:
code: "_tag{{ tag }}" #Becomes ""
collection: tag
layout: index
eleventyExcludeFromCollections: true
code
just becomes empty. Removing {{ tag }}
from the computed value still causes code
to be empty.
title: GenericTitle
pagination:
data: collections
size: 1
alias: tag
eleventyComputed:
code: "foo" #Becomes "" when it should be "foo"
permalink: /tags/{{ tag }}/
collection: tag
layout: index
eleventyExcludeFromCollections: true
Seems as if eleventyComputed
doesn't work with pagination at all
I think this is working for me in 2.0.0 final: https://github.com/pdehaan/11ty-2512/blob/main/src/tags.liquid
And my output www/tags/home/index.html has the following content:
<h1>home</h1>
code="foo"
I am also observing this issue when trying to follow the tag pagination instructions. Title is not being computed.
Even on ^2.0.2-alpha.2
I am seeing something similar: In 2.0.1
I have a template with this front matter:
--- pagination: data: events.parsed.allLocalPages size: 1 alias: event permalink: "events/{{ event.slug }}.html" eleventyComputed: title: "{{ event.name }}" ---
The title is being computed fine normally, but when I added title
in a directory data file one level up:
module.exports = { title: "blah blah" };
then the computed title in the paginated pages is returning ''.
I tried 2.0.2-alpha.2
and get the same result.
Hi all, this is specifically a problem with nunjucks. If you change your templates to liquid, md, handlebars, etc... it will work properly and eleventyComputed
values will be computed
more info -> #3120