Permalink
Browse files

partialised header and footer templates

  • Loading branch information...
RobinThrift committed Apr 18, 2014
1 parent c08a160 commit 58ba1d06938cc5fae76a070bd09fb03913474673
Showing with 34 additions and 14 deletions.
  1. +7 −1 index.js
  2. +3 −13 templates/home.hbt
  3. +6 −0 templates/partials/footer.hbt
  4. +18 −0 templates/partials/header.hbt
View
@@ -1,6 +1,12 @@
var Metalsmith = require('metalsmith'),
markdown = require('metalsmith-markdown'),
- templates = require('metalsmith-templates');
+ templates = require('metalsmith-templates'),
+ Handlebars = require('handlebars'),
+ fs = require('fs');
+
+
+Handlebars.registerPartial('header', fs.readFileSync(__dirname + '/templates/partials/header.hbt').toString());
+Handlebars.registerPartial('footer', fs.readFileSync(__dirname + '/templates/partials/footer.hbt').toString());
Metalsmith(__dirname)
View
@@ -1,13 +1,3 @@
-<!doctype html>
-<html lang="en">
-<head>
- <meta charset="UTF-8" />
- <title>{{ title }} | Metalsmith Page</title>
-</head>
-<body>
- <div class="main-wrapper">
- {{{ contents }}}
- </div>
-
-</body>
-</html>
+{{> header}}
+ {{{ contents }}}
+{{> footer}}
@@ -0,0 +1,6 @@
+ </div> {{!-- END .main-wrapper --}}
+ <footer>
+ Metalsmith test site
+ </footer>
+ </body>
+</html>
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <title>Metalsmith Test Site</title>
+
+ <meta name="viewport" content="width=device-width">
+ </head>
+ <body>
+
+ <header>
+ <h1 class="logo"><a href="/">Metalsmith Test Site</a></h1>
+ </header>
+
+
+ <div class="main-wrapper">
+

0 comments on commit 58ba1d0

Please sign in to comment.