RSS/ATOM Feed added, Prism changes, and global Copyright notice. (#94)

* Add Reason support to Prism.js

* Add XML/ATOM feed. Generates for both localhost and build script. Adds meta links to feeds to all html files.

* Updated /core/Footer.js to pull from siteConfig
This commit is contained in:
Eric Nakagawa 2017-09-27 12:49:09 -07:00 committed by Joel Marcey
parent 92ce92ee59
commit dc835770a0
15 changed files with 285 additions and 39 deletions

View file

@ -92,7 +92,7 @@ function extractMetadata(content) {
const both = splitHeader(content);
// if no content returned, then that means there was no header, and both.header is the content
if (!both.content) {
return { metadata, rawContent: both.header };
return {metadata, rawContent: both.header};
}
const lines = both.header.split("\n");
for (let i = 0; i < lines.length - 1; ++i) {
@ -104,7 +104,7 @@ function extractMetadata(content) {
} catch (e) {}
metadata[key] = value;
}
return { metadata, rawContent: both.content };
return {metadata, rawContent: both.content};
}
// process the metadata for a document found in the docs folder
@ -173,7 +173,7 @@ function processMetadata(file) {
}
}
return { metadata, rawContent: rawContent };
return {metadata, rawContent: rawContent};
}
// process metadata for all docs and save into core/metadata.js
@ -295,13 +295,26 @@ function generateBlogMetadata() {
.replace("-", "/")
.replace(/\./g, "-")
.replace(/\-md$/, ".html");
const result = extractMetadata(fs.readFileSync(file, { encoding: "utf8" }));
const result = extractMetadata(fs.readFileSync(file, {encoding: "utf8"}));
const rawContent = result.rawContent;
const metadata = Object.assign(
{ path: filePath, content: rawContent },
{path: filePath, content: rawContent},
result.metadata
);
metadata.id = metadata.title;
// Extract, YYYY, MM, DD from the file name
let filePathDateArr = path.basename(file).toString().split("-");
metadata.date = new Date(
filePathDateArr[0] +
"-" +
filePathDateArr[1] +
"-" +
filePathDateArr[2] +
"T06:00:00.000Z"
);
metadatas.push(metadata);
});