Basic templating

parent fc783208
......@@ -14,15 +14,15 @@ app.engine( 'handlebars', handlebars( {
} ) );
app.set( 'views', __dirname + '/render' );
var domains = [
'https://ethitter.com',
'https://erick.blog',
'https://i.ethitter.com'
];
var domains = {
'ethitter.com': 'https://ethitter.com/',
'erick.blog': 'https://erick.blog/',
'i.ethitter.com': 'https://i.ethitter.com/'
};
// Rendering
app.get( '/', function( req, res ) {
res.render( 'index', domains );
res.render( 'index', { data: { domains: domains } } );
} );
// Get some data
......
{{!< main}}
\ No newline at end of file
{{!< main}}
<h1>Welcome!</h1>
{{#each data.domains}}
<div class="site-container" id="site-{{@key}}">
<h2><a href="{{this}}">{{this}}</a></h2>
<span class="latest-post"></span>
</div>
{{/each}}
<!DOCTYPE>
<html>
<head>
<title></title>
<title>erick t. hitter's latest posts</title>
</head>
<body></body>
<body>
{{{body}}}
<div id="sites">
{{> sites}}
</div>
</body>
</html>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment