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:
committed by
Justin Fagnani
parent
2b3e914666
commit
fc662728eb
34
docs-src/_includes/example.11ty.cjs
Normal file
34
docs-src/_includes/example.11ty.cjs
Normal 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('<', '<') }</a>
|
||||
</li>
|
||||
`).join('')}
|
||||
</ul>
|
||||
</nav>
|
||||
<div>
|
||||
${content}
|
||||
</div>
|
||||
</section>
|
||||
`;
|
||||
};
|
||||
Reference in New Issue
Block a user