Skip to content
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
8 changes: 7 additions & 1 deletion lib/config-shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,13 @@ module.exports = function getConfig(meta) {

// trying to create a url for an object
if (context === 'post' && data.post) {
urlPath = data.post.preComputedRelativeUrl;
var relUrl = data.post.preComputedRelativeUrl;
var reg = /(index.html)$|(.html)$/g;
relUrl = relUrl.replace(reg, function (match, p1, p2) {
if (p1) { return '' };
return '/'
})
urlPath = relUrl;
secure = data.post.secure;
} else if (context === 'tag' && data.tag) {
urlPath = '/tag/' + data.tag.slug + '/';
Expand Down
13 changes: 7 additions & 6 deletions lib/pipelines.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ var _ = require('lodash'),
stream = require('./stream'),
xtend = require('xtend'),
clone = require('clone'),
hbs = require('handlebars');
hbs = require('handlebars'),
colors = require('colors');

function paginate(key, perPage, makeUrl) {
return through.obj(function(entry, enc, done) {
Expand Down Expand Up @@ -48,7 +49,7 @@ module.exports = function(theme, inPath, outPath) {
// { contents: md } -> { contents: html }
theme.stream('post'),
pi.mapKey('path', function(path, entry, index) { return outPath + entry.relativeUrl; }),
pi.forEach(function(obj) { console.log('Write post:', obj.path); }),
pi.forEach(function(obj) { console.log(colors.green('Write post:', obj.path)); }),
// { path: ... , contents: html } -> file
stream.dest()
]),
Expand All @@ -58,7 +59,7 @@ module.exports = function(theme, inPath, outPath) {
// { contents: md } -> { contents: html }
theme.stream('page'),
pi.mapKey('path', function(path, entry, index) { return outPath + entry.relativeUrl; }),
pi.forEach(function(obj) { console.log('Write page:', obj.path); }),
pi.forEach(function(obj) { console.log(colors.grey('Write page:', obj.path)); }),
// { path: ... , contents: html } -> file
stream.dest()
]),
Expand All @@ -73,7 +74,7 @@ module.exports = function(theme, inPath, outPath) {
theme.stream('index'),
// { pages: [ html ] } -> { path: ..., contents: html }
pi.mapKey('path', function(path, entry, index) { return outPath + entry.relativeUrl; }),
pi.forEach(function(obj) { console.log('Write index:', obj.path); }),
pi.forEach(function(obj) { console.log(colors.cyan('Write index:', obj.path)); }),
// { path: ... , contents: html } -> file
stream.dest()
]),
Expand All @@ -95,7 +96,7 @@ module.exports = function(theme, inPath, outPath) {
}),

paginate('posts', 5, function(entry, index) {
return '/tag/' + entry.tag +
return '/tag/' + entry.tag.name +
(index === 0 ? '/index.html' : '/page/' + (index + 1) + '/index.html');
}),
// { tag: name, posts: ALL } -> { tag: name, posts: subset, pagination: ... }
Expand Down Expand Up @@ -139,7 +140,7 @@ module.exports = function(theme, inPath, outPath) {
theme.stream('author'),
// { contents: html } -> { path: ..., contents: html }
pi.mapKey('path', function(path, entry, index) { return outPath + entry.relativeUrl; }),
pi.forEach(function(obj) { console.log('Write author:', obj.path); }),
pi.forEach(function(obj) { console.log(colors.yellow('Write author:', obj.path)); }),
// { path: ... , contents: html } -> file
stream.dest()
]),
Expand Down
Loading