add and include frontpage .hbs file and change background color inside .hbs

This commit is contained in:
readme 2020-03-18 21:50:43 +01:00
parent 27e371d2fb
commit 543713440f
3 changed files with 62 additions and 2 deletions

View file

@ -86,6 +86,15 @@ var metalsmith = Metalsmith(__dirname)
reverse: true, reverse: true,
refer: false refer: false
}, },
frontpage: {
pattern: 'index.*',
sortBy: 'priority',
reverse: true,
refer: false,
metadata: {
layout: './../src/layouts/frontpage.hbs' // default is <root>/layouts
}
},
docs: { docs: {
pattern: 'docs/**/*', pattern: 'docs/**/*',
sortBy: 'priority', sortBy: 'priority',
@ -138,6 +147,7 @@ var metalsmith = Metalsmith(__dirname)
// //engineOptions: {}, // //engineOptions: {},
// pattern: `partials.hbs/**` // pattern: `partials.hbs/**`
// })) // }))
// define default (add additional rules in collections plugin )
.use(layouts({ .use(layouts({
//engineOptions: {}, //engineOptions: {},
pattern: `**/index.*`, pattern: `**/index.*`,

View file

@ -4,9 +4,15 @@ description: A static HTML-only website generated using Metalsmith.io.
priority: 1.0 priority: 1.0
--- ---
<span style="color:red"> *some emphasized markdown text*</span>
<font color='blue'>test blue color font</font>
<span style="background-color: #FFFF00">Marked text</span>
[![Node.js]({{ root }}images/nodejs.png)](http://dash.org/) [![Node.js]({{ root }}images/nodejs.png)](http://dash.org/)
This is a static website generated using the Node.js-powered **[Metalsmith](http://metalsmith.io)** and various published and custom plugins. ffThis is a static website generated using the Node.js-powered **[Metalsmith](http://metalsmith.io)** and various published and custom plugins.
This is a demonstration rather than a recommended way to build a static site. Your requirements will be different. Please use any part of the code as you wish. This is a demonstration rather than a recommended way to build a static site. Your requirements will be different. Please use any part of the code as you wish.
@ -19,4 +25,4 @@ Metalsmith could be used to create:
* application prototypes * application prototypes
* build tools or project scaffolding * build tools or project scaffolding
[Get started&hellip;]({{ root }}docs/) [Get started&hellip;]({{ root }}docs/)

44
src/layouts/frontpage.hbs Normal file
View file

@ -0,0 +1,44 @@
<!DOCTYPE html>
<html>
<head>
{{> meta }}
<style>
main {background-color: #111833;}
h1 {color: blue;}
p {color: red;}
</style>
</head>
<body>
{{> header }}
{{!-- removed since there is no navsub (sidebar) in page layout --}}
{{!-- <main{{#if navsub}} class="subpages"{{/if}}> --}}
<main>
<div class="content">
{{!-- {{> navsub }} --}}
<article>
{{#if title}}
<h1>{{ title }}</h1>
{{/if}}
{{{ contents }}}
</article>
</div>
</main>
{{!-- {{> footer template='page' }} --}}
</body>
</html>