Tucker McKnight <tucker@pangolin.lan> | Sun Feb 22 2026
Make branches template use commonPage
0 1 2 3 4 5 6 7 8 9 10
import m from 'mithril'
import {NavHelper} from './helpers/nav.ts'
export default async (
eleventyConfig: any,
data: any,
nav: ReturnType<typeof NavHelper>
) => {
const slugify = eleventyConfig.getFilter("slugify")
const branchesWithWorkInProgress = data.branches.filter(branch => branch.ahead > 0)
const branchesFullyMerged = data.branches.filter(branch => branch.ahead === 0)0 1 2 3 4 5 6 7 8 9 10 11 12
import m from 'mithril'
import {NavHelper} from './helpers/nav.ts'
import htmlPage from './common/htmlPage.ts'
export default async (
reposConfig: any,
eleventyConfig: any,
data: any,
) => {
const slugify = eleventyConfig.getFilter("slugify")
const nav = NavHelper(reposConfig, slugify, data.branchInfo.repoName, data.branchInfo.branchName)
const branchesWithWorkInProgress = data.branches.filter(branch => branch.ahead > 0)
const branchesFullyMerged = data.branches.filter(branch => branch.ahead === 0)33 34 35 36 37 38 39 40 41
}))
}
return [
m('h1', {class: 'fs-2'}, 'Branches with unmerged commits'),
branchCards(branchesWithWorkInProgress),
m('h1', {class: 'fs-2'}, 'Branches that are fully merged'),
branchCards(branchesFullyMerged),
]
}33 34 35 36 37 38 39 40 41 42 43
}))
}
const pageContent = [
m('h1', {class: 'fs-2'}, 'Branches with unmerged commits'),
branchCards(branchesWithWorkInProgress),
m('h1', {class: 'fs-2'}, 'Branches that are fully merged'),
branchCards(branchesFullyMerged),
]
return await htmlPage(reposConfig, eleventyConfig, data, pageContent)
}18 19 20 21 22 23
import commitJsTemplate from './js_templates/commit.ts'
import commitsJsTemplate from './js_templates/commits.ts'
import indexJsTemplate from './js_templates/index.ts'
// import branchesJsTemplate from './js_templates/branches.ts'
import rawJsTemplate from './js_templates/raw.ts'
import feedJsTemplate from './js_templates/feed.ts'
18 19 20 21 22 23
import commitJsTemplate from './js_templates/commit.ts'
import commitsJsTemplate from './js_templates/commits.ts'
import indexJsTemplate from './js_templates/index.ts'
import branchesJsTemplate from './js_templates/branches.ts'
import rawJsTemplate from './js_templates/raw.ts'
import feedJsTemplate from './js_templates/feed.ts'
276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312
)
// BRANCHES.TS
// eleventyConfig.addTemplate(
// 'repos/branches.11ty.js',
// htmlPage(reposConfiguration, eleventyConfig, branchesJsTemplate),
// {
// pagination: {
// data: "branches",
// size: 1,
// alias: "branchInfo",
// },
// permalink: (data) => {
// const repoName = data.branchInfo.repoName
// const branchName = data.branchInfo.branchName
// return `${reposPath}/${eleventyConfig.getFilter("slugify")(repoName)}/branches/${eleventyConfig.getFilter("slugify")(branchName)}/branches/`
// },
// eleventyComputed: {
// nav: {
// repoName: (data) => data.branchInfo.repoName,
// branchName: (data) => data.branchInfo.branchName,
// path: "branches"
// },
// currentRepo: (data) => reposData.find(repo => {
// return repo.name === data.branchInfo.repoName
// }),
// currentBranch: (data) => reposData.find(repo => {
// return repo.name === data.branchInfo.repoName
// }).branches.find(branch => {
// return branch.name === data.branchInfo.branchName
// }),
// },
// navTab: "branches",
// }
// )
// FILE.TS
const flatFilesData = flatFiles(reposData)276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312
)
// BRANCHES.TS
eleventyConfig.addTemplate(
'repos/branches.11ty.js',
commonPage(branchesJsTemplate, reposConfiguration, eleventyConfig),
{
pagination: {
data: "branches",
size: 1,
alias: "branchInfo",
},
permalink: (data) => {
const repoName = data.branchInfo.repoName
const branchName = data.branchInfo.branchName
return `${reposPath}/${eleventyConfig.getFilter("slugify")(repoName)}/branches/${eleventyConfig.getFilter("slugify")(branchName)}/branches/`
},
eleventyComputed: {
nav: {
repoName: (data) => data.branchInfo.repoName,
branchName: (data) => data.branchInfo.branchName,
path: "branches"
},
currentRepo: (data) => reposData.find(repo => {
return repo.name === data.branchInfo.repoName
}),
currentBranch: (data) => reposData.find(repo => {
return repo.name === data.branchInfo.repoName
}).branches.find(branch => {
return branch.name === data.branchInfo.branchName
}),
},
navTab: "branches",
}
)
// FILE.TS
const flatFilesData = flatFiles(reposData)