Pass the branchname in to the renderContent function

bd55d123ec91c7b0d51af40f181f6bba4e05c755

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.
README.md:45
Before
44
45
46
47
48
49
  }
```


[test link to files page](files/readme-md)

branch: {{ branch }}
After
44
45



  }
```
⁣
⁣
⁣
⁣
js_templates/repo.ts:87
Before
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>
  `
After
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>
  `
main.ts:143
Before
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>`
After
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>`