You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Everything you’ve added to project’s configuration file will also be available in these renders too: shortcodes, filters, etc.
However, the Render plugin does not always render shortcodes/filters and does not evaluate Global Data.
Feature
Shortcodes/Filter Evaluates
Shortcodes/Filter Renders
Global Data Evaluates
Global Data Renders
njk
True
True
True
False
renderTemplate
True
False
False
False
renderFile
True
True
False
False
To Reproduce
Steps to reproduce the behavior:
Add to .eleventy.js:
eleventyConfig.addShortcode("now", () => {
return new Date();
});
eleventyConfig.addFilter("nowLocale", (locale) => {
return new Date().toLocaleDateString(locale);
});
Create _data/globalString.js
module.exports = "I am Global Data";
Create _data/globalStringShortcode.js
module.exports = "It is now {% now %}";
Create file renderFile.md
#### I am an h3 title
1. I am a numbered list
1. shortcode now: {% now %}
1. filter nowLocale: {{ "en-US" | nowLocale }}
1. ./src/\_data/globalString.js globalString: {{ globalString }} <mark>Does not evaluate nor render</mark>
1. ./src/\_data/globalStringShortcode.js globalStringShortcode: {{ globalStringShortcode }}
Create file: renderTest.njk
<h1>Render Test</h1>
<h2>njk</h2>
<h3>I am an h3 title</h3>
<ol>
<li>I am a numbered list</li>
<li>shortcode now: {% now %} </li>
<li>filter nowLocale: {{ "en-US" | nowLocale }} </li>
<li>./src/_data/globalString.js globalString: {{ globalString }} </li>
<li>./src/_data/globalStringShortcode.js globalStringShortcode: {{ globalStringShortcode }} </li>
</ol>
<h2>renderTemplate</h2>
{% renderTemplate "md" %}
#### I am an h3 title
1. I am a numbered list
1. shortcode now: {% now %} <mark>Does not render</mark>
1. filter nowLocale: {{ "en-US" | nowLocale }} <mark>Does not render</mark>
1. ./src/\_data/globalString.js globalString: {{ globalString }} <mark>Does not evaluate nor render</mark>
1. ./src/_data/globalStringShortcode.js globalStringShortcode: {{ globalStringShortcode }}
{% endrenderTemplate %}
<h2>renderFile</h2>
{% renderFile "renderFile.md" %}
Expected behavior
See highlighted text "Does not ..." for which examples do not evaluate and/or render the shortcodes/filters.
Screenshots
Here's the rendered page:
Environment:
Mac OS 10.13.6
Eleventy Version 1.0.0-beta.8
Additional context
The Global Data not rendering may be related to #2069.
The text was updated successfully, but these errors were encountered:
Describe the bug
According to the Render documentation:
However, the Render plugin does not always render shortcodes/filters and does not evaluate Global Data.
njk
renderTemplate
renderFile
To Reproduce
Steps to reproduce the behavior:
.eleventy.js
:_data/globalString.js
_data/globalStringShortcode.js
renderFile.md
renderTest.njk
Expected behavior
See highlighted text "Does not ..." for which examples do not evaluate and/or render the shortcodes/filters.
Screenshots
Here's the rendered page:
Environment:
Additional context
The Global Data not rendering may be related to #2069.
The text was updated successfully, but these errors were encountered: