diff --git a/includes/includes.js b/includes/includes.js index d7365de..4e7a32c 100644 --- a/includes/includes.js +++ b/includes/includes.js @@ -7,9 +7,6 @@ * @author Jeffery Russell */ -//used for file IO -const utils = require('../utils/utils.js'); - const HEADER_KEY = "header"; const FOOTER_KEY = "footer"; @@ -112,7 +109,6 @@ module.exports = { readFile(fileName).then(function(result) { - console.log(result); context[key] = result; resolve(); }).catch(function(error) diff --git a/includes/staticContentServer.js b/includes/staticContentServer.js index 905ddc4..03952ae 100644 --- a/includes/staticContentServer.js +++ b/includes/staticContentServer.js @@ -12,7 +12,9 @@ module.exports= serveStaticContent: function(request, result, filename, baseURL) { - fullPath = baseURL + filename; + var fullPath = baseURL + filename; + if(fullPath.charAt(0) === '/') + fullPath = fullPath.substring(1,); if (filename.includes(".svg") || filename.includes(".svg")) { includes.sendSVG(result, fullPath); diff --git a/routes/includes/index.js b/routes/includes/index.js index 70a5ddf..31b705d 100644 --- a/routes/includes/index.js +++ b/routes/includes/index.js @@ -10,9 +10,13 @@ const contentLoader = require('../../includes/staticContentServer.js'); routes.get('*', (request, result) => { var filename = url.parse(request.url, true).pathname; - - if(!contentLoader.serveStaticContent(request, result, filename, "includes")) + console.log(request.originalURL); + console.log(request.url.path); + if(!contentLoader.serveStaticContent(request, result, request.originalUrl, "")) { + + + //missing content } }); diff --git a/routes/index.js b/routes/index.js index 8b63124..b453916 100644 --- a/routes/index.js +++ b/routes/index.js @@ -19,6 +19,7 @@ routes.use('/downloads', downloads); /** static content like css, js, and images */ const includes = require('./includes'); routes.use('/includes', includes); +routes.use('/blogContent', includes); /** category pages */ diff --git a/utils/pageBuilder.js b/utils/pageBuilder.js index 198d227..b9c55db 100644 --- a/utils/pageBuilder.js +++ b/utils/pageBuilder.js @@ -149,15 +149,12 @@ module.exports = require("../blog/sidebar.js").main(templateContext)]) .then(function (content) { - console.log(JSON.stringify(content)); const html = whiskers.render(content[0], templateContext); result.write(html); result.end(); cache.put(filename + "?page=" + page, html); }).catch(function (err) { - console.log("dewie"); - console.log(err); cache.del(filename + "?page=" + page); module.exports.print404(result)