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

Variable 'section' is undefined within a "docs/_includes" template #121

Open
gdbaldw opened this issue Dec 6, 2020 · 2 comments
Open

Variable 'section' is undefined within a "docs/_includes" template #121

gdbaldw opened this issue Dec 6, 2020 · 2 comments

Comments

@gdbaldw
Copy link

gdbaldw commented Dec 6, 2020

I'd like to source "blog-details.njk" from the "docs/_includes" directory. Should this be possible? A bug?

I've isolated the issue to this line:

{{ collections[section] | rocketPageAnchors({ title: title }) | rocketNavToHtml({
TypeError: nodes is not iterable

@gdbaldw gdbaldw changed the title Copy into _includes/blog-details.njk causes Problem writing Eleventy templates Copy into docs/_includes/blog-details.njk causes Problem writing Eleventy templates Dec 6, 2020
@gdbaldw gdbaldw changed the title Copy into docs/_includes/blog-details.njk causes Problem writing Eleventy templates Copy blog-details.njk into docs/_includes/ causes Problem writing Eleventy templates Dec 7, 2020
@gdbaldw
Copy link
Author

gdbaldw commented Dec 7, 2020

BUG FOUND: The variable 'section' is undefined when the template is copied into "docs/_includes/".

MY SOLUTION: Replace the variable 'section' with the constant string "blog". So,

{{ collections["blog"] | rocketPageAnchors({ title: title }) | rocketNavToHtml({

No longer an issue for me, but worth noting that 'section' is undefined outside of the "blog" package.

@gdbaldw gdbaldw changed the title Copy blog-details.njk into docs/_includes/ causes Problem writing Eleventy templates Variable 'section' is undefined within a "docs/_includes" template Dec 7, 2020
@daKmoR
Copy link
Owner

daKmoR commented Dec 7, 2020

sweet - thx for looking into it 🤗

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

No branches or pull requests

2 participants