Tucker McKnight
Show readme on main page of new template Also restore the old template and put the new WIP template under a different URL. It's now at repo-name/new/
2 3
export default (reposConfig: ReposConfiguration, slugify: Function) => {
return (data) => {
2 3
export default async (reposConfig: ReposConfiguration, eleventyConfig: any) => {
return async (data) => {
const slugify = eleventyConfig.getFilter("slugify")
const renderContentIfAvailable = eleventyConfig.getFilter("renderContentIfAvailable")
const getReadMe = eleventyConfig.getFilter("getReadMe")
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190
<div class="row">
<div class="col">
<div class="p-2 my-3 bezel-gray">
<ul class="nav">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="#">Active</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item">
<a class="nav-link disabled" aria-disabled="true">Disabled</a>
</li>
</ul>
</div>
</div>
</div>
<div class="row">
<div class="col">
<h1 class="blue">Body Heading</h1>
<p>Body paragraph.</p>
</div>
</div>
<div class="row my-2">
<div class="col">
<button type="button" class="btn btn-outline-secondary shadow-none">Secondary</button>
<button type="button" class="btn btn-lg shadow-none btn-outline-warning">Secondary</button>
</div>
</div>
<div class="row">
<div class="col">
<div class="input-group mb-3">
<span class="input-group-text">Search for files:</span>
<input type="text" class="form-control" placeholder="Username" aria-label="Username" aria-describedby="basic-addon1">
</div>
</div>
</div>
<div class="row">
<div class="p-2 my-2 bezel-purple">
test
</div>
</div>
</div>
<div class="row m-3">
<div class="col-3">
<div class="card bezel-gray">
<div class="card-header">
Featured
</div>
<div class="card-body">
<h5 class="card-title">Special title treatment</h5>
<p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
<a href="#" class="btn btn-primary">Go somewhere</a>
</div>
<div class="card-footer">
some text in here
</div>
</div>
</div>
<div class="col-3">
<div class="card bezel-gray" style="width: 18rem;">
<div class="card-body">
<h5 class="card-title">Card title</h5>
<p class="card-text">Some quick example text to build on the card title and make up the bulk of the card’s content.</p>
<a href="#" class="btn btn-primary">Go somewhere</a>
</div>
</div>
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190
<div class="row my-4 mx-1">
${await renderContentIfAvailable(await getReadMe(repo.name, branch.name), "md")}
379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412
// const repoTemplate = fsImport.readFileSync(`${import.meta.dirname}/templates/repo.njk`).toString()
// eleventyConfig.addTemplate(
// 'repos/repo.njk',
// topLayoutPartial + repoTemplate + bottomLayoutPartial,
// {
// pagination: {
// data: "branches",
// size: 1,
// alias: "branch",
// },
// permalink: (data) => {
// const repoName = data.branch.repoName
// const branchName = data.branch.branchName
// return `${reposPath}/${eleventyConfig.getFilter("slugify")(repoName)}/branches/${eleventyConfig.getFilter("slugify")(branchName)}/`
// },
// eleventyComputed: {
// nav: {
// repoName: (data) => data.branch.repoName,
// branchName: (data) => data.branch.branchName,
// path: "",
// },
// currentRepo: (data) => reposData.find(repo => {
// return repo.name === data.branch.repoName
// }),
// currentBranch: (data) => reposData.find(repo => {
// return repo.name === data.branch.repoName
// }).branches.find(branch => {
// return branch.name === data.branch.branchName
// }),
// },
// navTab: "landing",
// }
// )
repoJsTemplate(reposConfiguration, eleventyConfig.getFilter("slugify")),
379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412
const repoTemplate = fsImport.readFileSync(`${import.meta.dirname}/templates/repo.njk`).toString()
eleventyConfig.addTemplate(
'repos/repo.njk',
topLayoutPartial + repoTemplate + bottomLayoutPartial,
{
pagination: {
data: "branches",
size: 1,
alias: "branch",
},
permalink: (data) => {
const repoName = data.branch.repoName
const branchName = data.branch.branchName
return `${reposPath}/${eleventyConfig.getFilter("slugify")(repoName)}/branches/${eleventyConfig.getFilter("slugify")(branchName)}/`
},
eleventyComputed: {
nav: {
repoName: (data) => data.branch.repoName,
branchName: (data) => data.branch.branchName,
path: "",
},
currentRepo: (data) => reposData.find(repo => {
return repo.name === data.branch.repoName
}),
currentBranch: (data) => reposData.find(repo => {
return repo.name === data.branch.repoName
}).branches.find(branch => {
return branch.name === data.branch.branchName
}),
},
navTab: "landing",
}
)
const template = repoJsTemplate(reposConfiguration, eleventyConfig)
template,
426
return `${reposPath}/${eleventyConfig.getFilter("slugify")(repoName)}/branches/${eleventyConfig.getFilter("slugify")(branchName)}/`
426
return `${reposPath}/${eleventyConfig.getFilter("slugify")(repoName)}/new/${eleventyConfig.getFilter("slugify")(branchName)}/`