Add a static site generator

There is no build for the element or site utilities like PrismJS yet, so this site only works locally at the moment.
This commit is contained in:
Justin Fagnani
2019-12-19 20:48:45 -08:00
committed by Justin Fagnani
parent 2b3e914666
commit fc662728eb
28 changed files with 5770 additions and 6 deletions

View File

@@ -0,0 +1,34 @@
const page = require('./page.11ty.cjs');
/**
* This template extends the page template and adds an examples list.
*/
module.exports = function(data) {
return page({
...data,
content: renderExample(data),
});
};
const renderExample = ({name, content, collections, page}) => {
return `
<h1>Example: ${name}</h1>
<section class="examples">
<nav class="collection">
<ul>
${collections.example === undefined
? ''
: collections.example.map((post) => `
<li class=${post.url === page.url ? 'selected' : ''}>
<a href="/docs${post.url}">${ post.data.description.replace('<', '&lt;') }</a>
</li>
`).join('')}
</ul>
</nav>
<div>
${content}
</div>
</section>
`;
};