Skip to content

How can I make an async shortcode? #1991

Answered by Dima34
Dima34 asked this question in Q&A
Discussion options

You must be logged in to vote

I`ve found an aswer: You need 2 use addNunjucksAsyncShortcode to use async functions

eleventyConfig.addNunjucksAsyncShortcode("articleHBblock", async (title, url, text, imageUrl, alt, tags=["test", "test"])=>{ return `
${(await eleventyConfig.nunjucksAsyncShortcodes.pictureSvgBase64Png(imageUrl, alt, 20, 20))}

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Dima34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant