-
|
Hello all, i have this simpl link iterator which works fine, however i would like to know if there is any way to perform anything similar using webc templates. const list = require("../assets/links.json")
module.exports = class {
data() {
return {
"layout": "base.webc"
}
}
mkLink(l) {
return `<a style="display:inline-block;" href="${l.link}" target="_blank">${l.label}</a>\n`
}
render(data) {
return `<br/>${list.map(this.mkLink).join("")}`
}
}thanks in advance for any guidance |
Beta Was this translation helpful? Give feedback.
Answered by
darthmall
Feb 12, 2023
Replies: 1 comment 2 replies
-
|
You can use a render function: https://11ty.webc.fun/recipes/looping-render-function/ |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
sombriks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can use a render function: https://11ty.webc.fun/recipes/looping-render-function/