add layout hbs files for docs, boxes, tutorials and blog

add pagelist-docs partial
This commit is contained in:
readme 2020-03-23 12:06:29 +01:00
parent 6d07d54042
commit e8385b274b
8 changed files with 280 additions and 8 deletions

View file

@ -101,17 +101,17 @@ var metalsmith = Metalsmith(__dirname)
reverse: true,
refer: true,
metadata: {
layout: './../src/layouts/article.hbs' // default is <root>/layouts
layout: './../src/layouts/docs.hbs' // default is <root>/layouts
}
},
article: {
pattern: 'article/**/*',
blog: {
pattern: 'blog/**/*',
sortBy: 'date',
reverse: true,
refer: true,
limit: 50,
metadata: {
layout: './../src/layouts/article.hbs'
layout: './../src/layouts/blog.hbs'
}
},
tutorials: {
@ -120,6 +120,9 @@ var metalsmith = Metalsmith(__dirname)
reverse: true,
refer: true,
limit: 50,
metadata: {
layout: './../src/layouts/tutorials.hbs'
}
},
boxes: {
pattern: 'boxes/**/*',
@ -127,13 +130,16 @@ var metalsmith = Metalsmith(__dirname)
reverse: true,
refer: true,
limit: 50,
metadata: {
layout: './../src/layouts/boxes.hbs'
}
}
}))
.use(markdownPrecompiler({ // convert {{> navmain}} in header.html
engine: "handlebars",
pattern: /\.md$/, // regex; no idea why .md works, check discoverPartials above
partialsPath: './../partials',
partials: ['navmain', 'navsub', 'footer', 'header', 'meta', 'pagelist']
partials: ['navmain', 'navsub', 'footer', 'header', 'meta', 'pagelist', 'pagelist-docs']
}))
.use(markdown()) // convert markdown
.use(permalinks({ // generate permalinks
@ -173,8 +179,8 @@ metalsmith
hostname: siteMeta.domain + (siteMeta.rootpath || ''),
omitIndex: true // replace any paths ending in index.html with ''. Useful when you're using metalsmith-permalinks.
}))
.use(rssfeed({ // generate RSS feed for articles
collection: 'article',
.use(rssfeed({ // generate RSS feed for articles (update: now blog)
collection: 'blog',
site_url: siteMeta.domain + (siteMeta.rootpath || ''),
title: siteMeta.name,
description: siteMeta.desc

View file

@ -1,7 +1,8 @@
---
title: blockman
description: WIP from the cloud on wheels
priority: 0.7
---
WIP from the cloud on wheels
WIP from the cloud on wheels

View file

@ -1,5 +1,6 @@
---
title: dashbox
description: Simple development framework for Dash Platform
priority: 0.8
---

65
src/layouts/blog.hbs Normal file
View file

@ -0,0 +1,65 @@
<!DOCTYPE html>
<html>
<head>
{{> meta }}
</head>
<body>
{{> header }}
<main{{#if navsub}} class="subpages" {{/if}}>
<div class="content">
{{> navsub }}
<article>
<h1>{{ title }}</h1>
{{#if isPage}}
{{else}}
<p class="articleinfo">Published {{ dateFormat }}, {{ wordCount }} words, {{ readingTime }}-minute read</p>
{{/if}}
{{{ contents }}}
{{#if isPage}}
{{> pagelist }}
{{else}}
<nav class="nav page">
<ul>
{{#if previous.title }}
<li><a href="{{ root }}{{ previous.path }}/" class="back">&laquo; back: {{ previous.title }}</a></li>
</p>
{{/if}}
{{#if next.title }}
<li><a href="{{ root }}{{ next.path }}/" class="next">next: {{ next.title }} &raquo;</a></li>
</p>
{{/if}}
</ul>
</nav>
{{/if}}
</article>
{{> footer template='article' }}
</div>
</main>
</body>
</html>

51
src/layouts/boxes.hbs Normal file
View file

@ -0,0 +1,51 @@
<!DOCTYPE html>
<html>
<head>
{{> meta }}
</head>
<body>
{{> header }}
{{!-- <main{{#if navsub}} class="subpages" {{/if}}> --}}
<main>
<div class="content">
{{!-- {{> navsub }} --}}
<article>
<h1>{{ title }}</h1>
{{#if isPage}}
{{else}}
<p class="articleinfo">Published {{ dateFormat }}, {{ wordCount }} words, {{ readingTime }}-minute read</p>
{{/if}}
{{{ contents }}}
{{#if isPage}}
{{> pagelist }}
{{else}}
{{/if}}
</article>
{{> footer template='article' }}
</div>
</main>
</body>
</html>

65
src/layouts/docs.hbs Normal file
View file

@ -0,0 +1,65 @@
<!DOCTYPE html>
<html>
<head>
{{> meta }}
</head>
<body>
{{> header }}
<main{{#if navsub}} class="subpages" {{/if}}>
<div class="content">
{{> navsub }}
<article>
<h1>{{ title }}</h1>
{{#if isPage}}
{{else}}
<p></p>
{{/if}}
{{{ contents }}}
{{#if isPage}}
{{> pagelist-docs }}
{{else}}
<nav class="nav page">
<ul>
{{#if previous.title }}
<li><a href="{{ root }}{{ previous.path }}/" class="back">&laquo; back: {{ previous.title }}</a></li>
</p>
{{/if}}
{{#if next.title }}
<li><a href="{{ root }}{{ next.path }}/" class="next">next: {{ next.title }} &raquo;</a></li>
</p>
{{/if}}
</ul>
</nav>
{{/if}}
</article>
{{> footer template='article' }}
</div>
</main>
</body>
</html>

65
src/layouts/tutorials.hbs Normal file
View file

@ -0,0 +1,65 @@
<!DOCTYPE html>
<html>
<head>
{{> meta }}
</head>
<body>
{{> header }}
<main{{#if navsub}} class="subpages" {{/if}}>
<div class="content">
{{> navsub }}
<article>
<h1>{{ title }}</h1>
{{#if isPage}}
{{else}}
<p class="articleinfo">Published {{ dateFormat }}, {{ wordCount }} words, {{ readingTime }}-minute read</p>
{{/if}}
{{{ contents }}}
{{#if isPage}}
{{> pagelist }}
{{else}}
<nav class="nav page">
<ul>
{{#if previous.title }}
<li><a href="{{ root }}{{ previous.path }}/" class="back">&laquo; back: {{ previous.title }}</a></li>
</p>
{{/if}}
{{#if next.title }}
<li><a href="{{ root }}{{ next.path }}/" class="next">next: {{ next.title }} &raquo;</a></li>
</p>
{{/if}}
</ul>
</nav>
{{/if}}
</article>
{{> footer template='article' }}
</div>
</main>
</body>
</html>

View file

@ -0,0 +1,18 @@
{{#if navsub}}
<ul class="pagelist">
{{#each navsub}}
<li>
<a href="{{ path }}">
<h2>{{ title }}</h2>
{{#if description}}
<p>{{ description }}</p>
{{/if}}
</a>
</li>
{{/each}}
</ul>
{{/if}}