Skip to content

Logic in jade temps fix #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: listsInJadeTemps
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
var express = require('express'),
posts = require('./mock/posts.json');

var postsLists = Object.keys(posts).map(function(value) {
return posts[value]})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing semicolon.


var app = express();

app.use('/static', express.static(__dirname + '/public'))
Expand All @@ -18,7 +21,7 @@ app.get('/blog/:title?', function(req, res){
var title = req.params.title;
if (title === undefined) {
res.status(503);
res.send("This page is under construction!");
res.render('blog', {posts: postsLists})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing semicolon.

} else {
var post = posts[title] || {};
res.render('post', { post: post});
Expand Down
13 changes: 13 additions & 0 deletions src/templates/blog.jade
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
extends ./layout

block content

for post in posts
section.post
.container
.row
.col-lg-8.col-lg-offset-2.text-center
h2.section-heading #{post.title}
hr.light
p.text-faded #{post.description}
a(href='/blog/' + post.title).btn.btn-default.btn-xl Read more!