GitBlog.md
- A static blog using Markdown pulled from your git repository +<%= info.title %>
+ <%= info.description %>Articles in this blog :
<% articles.forEach((article) => { %>
diff --git a/sample_data/home/template.ejs b/sample_data/home/template.ejs
index 6acc674..872322c 100644
--- a/sample_data/home/template.ejs
+++ b/sample_data/home/template.ejs
@@ -2,7 +2,19 @@
- GitBlog.md - <%= article.title %>
+ <%= info.title %> - <%= article.title %>
+
+
+ <%= `` %>
+ <%= `` %>
+ <%= `` %>
+ <%= `` %>
+ <%= `` %>
+ <% if (article.thumbnail) { %>
+ <%= `` %>
+ <%= `` %>
+ <% } %>
+
diff --git a/src/app.js b/src/app.js
index 2dd6093..e0bb3cb 100644
--- a/src/app.js
+++ b/src/app.js
@@ -36,6 +36,7 @@ module.exports = (config) => {
const articles = {};
let lastRSS = '';
+ let host;
/**
* Fetch articles from the data folder and send success as a response
@@ -73,6 +74,9 @@ module.exports = (config) => {
*/
const render = (res, vPath, data, code = 200) => {
data.info = {
+ title: config['home']['title'],
+ description: config['home']['description'],
+ host: host,
version: pjson.version
};
res.render(vPath, data, (err, html) => {
@@ -100,6 +104,14 @@ module.exports = (config) => {
});
};
+ app.use((req, res, next) => {
+ if (!host) {
+ host = 'http://' + req.headers.host;
+ console.log(cons.ok, 'Currently hosted on ' + host);
+ }
+ next();
+ });
+
//log request at result end
app.use((req, res, next) => {
if (config['access_log']) {
diff --git a/src/config.default.json b/src/config.default.json
index d5e5518..687ef07 100644
--- a/src/config.default.json
+++ b/src/config.default.json
@@ -12,6 +12,8 @@
"plantuml": true
},
"home": {
+ "title": "GitBlog.md",
+ "description": "A static blog using Markdown pulled from your git repository",
"index": "index.ejs",
"error": "error.ejs",
"hidden": [