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

this.ctx available in filter but not in shortcode #1584

Closed
aomader opened this issue Jan 10, 2021 · 4 comments
Closed

this.ctx available in filter but not in shortcode #1584

aomader opened this issue Jan 10, 2021 · 4 comments

Comments

@aomader
Copy link

aomader commented Jan 10, 2021

Is there a particular reason why this.ctx is available in a custom filter, but not in a custom shortcode? Is there an alternative approach to access the ctx in a shortcode?

@pdehaan
Copy link
Contributor

pdehaan commented Jan 10, 2021

Interesting... What is this.ctx? Is that a Nunjucks thing?
Only other reference I found to it was #567 (comment)

I created https://github.com/pdehaan/11ty-filter-context but it looks like this.ctx and this.getVariables() only works in Nunjucks (and returns undefined for this.ctx in LiquidJS, and fails hard on this.getVariables()).

@aomader
Copy link
Author

aomader commented Jan 11, 2021

Seems like, initially I assumed it was provided by eleventy. Still, I do not get why it is present in a filter but not in a shortcode.

@zachleat
Copy link
Member

We could restore ctx, I think?

Related to #1522

@zachleat
Copy link
Member

this.ctx will be available in Nunjucks shortcodes in 1.0.0-beta.9

@zachleat zachleat added this to the Eleventy 1.0.0 milestone Nov 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants