Tucker McKnight <tucker@pangolin.lan> | Wed Dec 31 2025
Pass the branchname in to the renderContent function
This will allow you to do something like {{ branch }} inside of
the readme, and it will print out the name of the current branch.
This should be useful for hyperlinks, too.44 45 46 47 48 49
}
```
[test link to files page](files/readme-md)
branch: {{ branch }}44 45
}
```
86 87 88 89 90 91
</div>
<div class="row my-4 mx-1">
<div class="col">
${await renderContentIfAvailable(await getReadMe(repo.name, branch.name), "md")}
</div>
</div>
`86 87 88 89 90 91
</div>
<div class="row my-4 mx-1">
<div class="col">
${await renderContentIfAvailable(await getReadMe(repo.name, branch.name), branch.name)}
</div>
</div>
`142 143 144 145 146 147 148 149 150
}
})
eleventyConfig.addAsyncFilter("renderContentIfAvailable", async (contentString: string, contentType: string) => {
const renderer = eleventyConfig?.javascript?.functions?.renderContent
if (renderer) {
return await renderer.bind({})(contentString, contentType)
}
else {
return `<pre>${contentString}</pre>`142 143 144 145 146 147 148 149 150 151 152 153 154
}
})
eleventyConfig.addAsyncFilter("renderContentIfAvailable", async (contentString: string, branchName: string) => {
const renderer = eleventyConfig?.javascript?.functions?.renderContent
if (renderer) {
return await renderer.bind({
data: {
branch: branchName
},
})(contentString, "liquid,md")
}
else {
return `<pre>${contentString}</pre>`