Pages metadata by default
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "gitblog.md",
|
"name": "gitblog.md",
|
||||||
"version": "1.1.3",
|
"version": "1.1.4",
|
||||||
"description": "A static blog using Markdown pulled from your git repository.",
|
"description": "A static blog using Markdown pulled from your git repository.",
|
||||||
"main": "src/server.js",
|
"main": "src/server.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -2,13 +2,21 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>GitBlog.md - Home</title>
|
<title><%= info.title %> - Home</title>
|
||||||
|
|
||||||
|
<meta name="twitter:card" content="summary_large_image">
|
||||||
|
<%= `<meta property="og:title" content="${info.title} - ${article.title}">` %>
|
||||||
|
<%= `<meta property="twitter:title" content="${info.title} - ${article.title}">` %>
|
||||||
|
<%= `<meta property="og:description" content="${info.description}">` %>
|
||||||
|
<%= `<meta property="twitter:description" content="${info.description}">` %>
|
||||||
|
<%= `<meta property="org:url" content="${info.host}/">` %>
|
||||||
|
|
||||||
<link rel="stylesheet" type="text/css" href="style.css">
|
<link rel="stylesheet" type="text/css" href="style.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<main>
|
<main>
|
||||||
<h1>GitBlog.md</h1>
|
<h1><%= info.title %></h1>
|
||||||
A static blog using Markdown pulled from your git repository
|
<%= info.description %>
|
||||||
<h2>Articles in this blog :</h2>
|
<h2>Articles in this blog :</h2>
|
||||||
<% articles.forEach((article) => { %>
|
<% articles.forEach((article) => { %>
|
||||||
<div class="article">
|
<div class="article">
|
||||||
|
|||||||
@@ -2,7 +2,19 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>GitBlog.md - <%= article.title %></title>
|
<title><%= info.title %> - <%= article.title %></title>
|
||||||
|
|
||||||
|
<meta name="twitter:card" content="summary_large_image">
|
||||||
|
<%= `<meta property="og:title" content="${info.title} - ${article.title}">` %>
|
||||||
|
<%= `<meta property="twitter:title" content="${info.title} - ${article.title}">` %>
|
||||||
|
<%= `<meta property="og:description" content="${info.description}">` %>
|
||||||
|
<%= `<meta property="twitter:description" content="${info.description}">` %>
|
||||||
|
<%= `<meta property="org:url" content="${info.host + article.url}">` %>
|
||||||
|
<% if (article.thumbnail) { %>
|
||||||
|
<%= `<meta property="org:image" content="${info.host + article.thumbnail}">` %>
|
||||||
|
<%= `<meta property="twitter:image" content="${info.host + article.thumbnail}">` %>
|
||||||
|
<% } %>
|
||||||
|
|
||||||
<link rel="stylesheet" type="text/css" href="/prism.css">
|
<link rel="stylesheet" type="text/css" href="/prism.css">
|
||||||
<link rel="stylesheet" type="text/css" href="/style.css">
|
<link rel="stylesheet" type="text/css" href="/style.css">
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
+12
@@ -36,6 +36,7 @@ module.exports = (config) => {
|
|||||||
|
|
||||||
const articles = {};
|
const articles = {};
|
||||||
let lastRSS = '';
|
let lastRSS = '';
|
||||||
|
let host;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch articles from the data folder and send success as a response
|
* 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) => {
|
const render = (res, vPath, data, code = 200) => {
|
||||||
data.info = {
|
data.info = {
|
||||||
|
title: config['home']['title'],
|
||||||
|
description: config['home']['description'],
|
||||||
|
host: host,
|
||||||
version: pjson.version
|
version: pjson.version
|
||||||
};
|
};
|
||||||
res.render(vPath, data, (err, html) => {
|
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
|
//log request at result end
|
||||||
app.use((req, res, next) => {
|
app.use((req, res, next) => {
|
||||||
if (config['access_log']) {
|
if (config['access_log']) {
|
||||||
|
|||||||
@@ -12,6 +12,8 @@
|
|||||||
"plantuml": true
|
"plantuml": true
|
||||||
},
|
},
|
||||||
"home": {
|
"home": {
|
||||||
|
"title": "GitBlog.md",
|
||||||
|
"description": "A static blog using Markdown pulled from your git repository",
|
||||||
"index": "index.ejs",
|
"index": "index.ejs",
|
||||||
"error": "error.ejs",
|
"error": "error.ejs",
|
||||||
"hidden": [
|
"hidden": [
|
||||||
|
|||||||
Reference in New Issue
Block a user