forked from postachio/postachio-theme-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
141 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
var swig = require('swig'); | ||
|
||
swig.setFilter('format_tag', function(input, id) { | ||
return input[id]; | ||
}); | ||
|
||
swig.setFilter('format_date', function(input, id) { | ||
return '2014-11-10'; | ||
}); | ||
|
||
swig.setFilter('format_tag', function(input, id) { | ||
return 'tag'; | ||
}); | ||
|
||
module.exports = function(type) { | ||
|
||
var global = { | ||
assets: function(location) { | ||
return '/assets/' + location; | ||
}, | ||
static: function(location) { | ||
return 'http://postach.io/static/' + location; | ||
}, | ||
set_active: function(location) { | ||
return 'active'; | ||
}, | ||
header_meta: '', | ||
footer_meta: '', | ||
login_form: '', | ||
is_login: false, | ||
is_home: false, | ||
is_tag: false, | ||
site: { | ||
avatar: '', | ||
author: '', | ||
name: '', | ||
analytics: false, | ||
cover_photo: '', | ||
facebook: '', | ||
twitter: '', | ||
googleplus: '', | ||
linkedin: '', | ||
atom_url: '', | ||
disqus: '', | ||
base_url: '/' | ||
}, | ||
post: { | ||
title: '' | ||
}, | ||
posts: [{ | ||
permalink: '', | ||
title: '', | ||
content: '', | ||
created_at: '', | ||
type: 'post', | ||
url: '', | ||
tags: ['tag-one', 'another-tag', 'content'] | ||
}], | ||
tag: { | ||
name: '' | ||
}, | ||
page: { | ||
permalink: '', | ||
title: '' | ||
}, | ||
pages: [{ | ||
_id: '', | ||
permalink: '', | ||
title: '', | ||
content: '' | ||
}], | ||
pagination: { | ||
prev: '', | ||
next: '' | ||
} | ||
}; | ||
|
||
var data = { | ||
page: global, | ||
post: global, | ||
tag: global, | ||
home: global | ||
} | ||
|
||
return data[type]; | ||
|
||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
var express = require('express'); | ||
var app = express(); | ||
var swig = require('swig'); | ||
var http = require('http'); | ||
var url = require('url'); | ||
var cons = require('consolidate'); | ||
var path = require('path'); | ||
var bootstrap = require('./routes'); | ||
|
||
// set swig as templating engine | ||
app.use('/assets', express.static(__dirname + '/../assets')); | ||
app.engine('html', cons.swig); | ||
app.set('view engine', 'html'); | ||
app.set('views', __dirname + '/../'); | ||
|
||
// make routes, add content, etc. | ||
bootstrap(app); | ||
|
||
// create server | ||
var server = app.listen(8000, function() { | ||
var host = server.address().address; | ||
var port = server.address().port; | ||
console.log('Example app listening at http://%s:%s', host, port); | ||
}); | ||
|
||
module.exports = server; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
var content = require('./content'); | ||
|
||
module.exports = function(app) { | ||
|
||
app.route('/') | ||
.get(function(req, res) { | ||
res.render('index', content('home')); | ||
}); | ||
|
||
app.route('/:slug') | ||
.get(function(req, res){ | ||
console.log('Called post route.'); | ||
res.render('index', content('post')); | ||
}); | ||
|
||
app.route('/tag/:tag') | ||
.get(function(req, res){ | ||
console.log('Called /tag/ route.'); | ||
res.render('index', content('tag')); | ||
}); | ||
|
||
app.route('/page/:slug') | ||
.get(function(req, res){ | ||
console.log('Called /page/ route.'); | ||
res.render('index', content('page')); | ||
}); | ||
|
||
}; |