This commit is contained in:
parent
9270cf8bed
commit
798e8cd8e3
2 changed files with 23 additions and 3 deletions
20
node/rss.js
20
node/rss.js
|
@ -1,6 +1,9 @@
|
|||
const {
|
||||
Feed
|
||||
} = require("feed");
|
||||
const {
|
||||
JSDOM
|
||||
} = require("jsdom");
|
||||
const fs = require("fs");
|
||||
const converter = require("./showdown")(1);
|
||||
|
||||
|
@ -40,13 +43,24 @@ function createFeed(callback) {
|
|||
const post = json[i];
|
||||
const date = new Date(post.date);
|
||||
const index = i;
|
||||
fs.readFile(`${__dirname}/../blog/src/${post.id}.md`, function (_, content) {
|
||||
let html = converter.makeHtml(content.toString());
|
||||
let extension = post.book ? "html" : "md";
|
||||
fs.readFile(`${__dirname}/../blog/src/${post.id}.${extension}`, function (_, file) {
|
||||
let content;
|
||||
if (post.book) {
|
||||
let html = new JSDOM(file);
|
||||
let page = html.window.document.getElementById("page");
|
||||
let header = page.getElementsByTagName("header");
|
||||
while (header.length > 0)
|
||||
header[0].parentNode.removeChild(header[0]);
|
||||
content = page.innerHTML;
|
||||
} else {
|
||||
content = converter.makeHtml(file.toString());
|
||||
}
|
||||
feed.addItem({
|
||||
title: `${post.name}${post.archived ? " (Archived)" : ""}`,
|
||||
link: `https://ellpeck.de/blog/${post.id}`,
|
||||
description: post.summary,
|
||||
content: html,
|
||||
content: content,
|
||||
date: date,
|
||||
published: date,
|
||||
category: post.cat.map(c => ({
|
||||
|
|
|
@ -43,3 +43,9 @@ h6 {
|
|||
margin-bottom: 1em;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.list-display {
|
||||
max-width: 35.5em;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue