Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
zachleat committed Jun 8, 2020
1 parent 7146d33 commit 0e83244
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions docs/filters.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,14 @@ We also provide a few universal filters, built-in:

{{ collections.all | eleventyNavigation("Filters") | eleventyNavigationToHtml({ showExcerpt: true }) | safe }}

#### Access existing filters {% addedin "0.11.0" %}

If you’d like to reuse existing filters in a different way, consider using the new Configuration API `getFilter` method. You can use this to alias a filter to a different name. You can use this to use a filter inside of your own filter. You can use this to use a filter inside of a shortcode.

```js
module.exports = function(eleventyConfig) {
eleventyConfig.addShortcode("myCustomImage", function(url, alt) {
return `<img src="${eleventyConfig.getFilter("url", url)}"> alt="${alt}">`;

This comment has been minimized.

Copy link
@chrisko

chrisko Jun 26, 2020

This may need to read eleventyConfig.getFilter("url")(url).

});
};
```

0 comments on commit 0e83244

Please sign in to comment.