Git Static Site UI is a plugin for Build Awesome that creates plain, static HTML pages for displaying a git repository. You can read code, browse commits, and clone the repository purely from plain old files on a web server. It's sort of like a read-only version of GitHub, and requires no logic on the backend whatsoever.
npm install this plugin
npm install --save git-static-site-ui
Add this plugin to your eleventy config, giving it a repo configuration object that describes the name and location of the repositories that you want to display.
import gitStaticSiteUi, {beforeHook} from 'git-static-site-ui'
export default (eleventyConfig) => {
const reposConfig = {
repos: {
"My Cool Project": {
location: "/home/me/code/cool-project",
defaultBranch: 'main',
},
},
path: "/repos",
baseUrl: "https://example.com",
}
eleventyConfig.on("eleventy.beforeConfig", beforeHook(eleventyConfig, reposConfig))
eleventyConfig.addPlugin(gitStaticSiteUi, reposConfig)
}
Then generate your website with npx @11ty/eleventy --serve. The generated HTML pages for browsing your git repositories will be at http://localhost:8080/repos.