-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
55cd14d
commit 758a896
Showing
13 changed files
with
87 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,7 @@ const addFromDir = dir => { | |
const parsedYamlHeader = YAML.parse(yamlHeader); | ||
posts.push({ | ||
path: `${dir}/${name}`, | ||
parsedDate: new Date(parsedYamlHeader.time + " UTC"), | ||
...parsedYamlHeader | ||
}); | ||
} | ||
|
@@ -48,7 +49,7 @@ const addFromDir = dir => { | |
addFromDir("."); | ||
addFromDir("ru"); | ||
|
||
posts.sort((a, b) => b.ordering - a.ordering); | ||
posts.sort((a, b) => b.parsedDate - a.parsedDate); | ||
|
||
let content = posts.map(post => { | ||
return ` | ||
|
@@ -69,3 +70,29 @@ html = html.replace(/{{ content }}/g, content); | |
html = minifyHtml.minify(Buffer.from(html), {}); | ||
|
||
fs.writeFileSync("index.html", html); | ||
|
||
fs.writeFileSync("feed.rss", `<?xml version="1.0" encoding="UTF-8" ?> | ||
<rss version="2.0"> | ||
<channel> | ||
<title>purplesyringa's blog</title> | ||
<link>https://purplesyringa.moe/blog/</link> | ||
<description>Posts from purplesyringa's blog.</description> | ||
<copyright>CC BY</copyright> | ||
<managingEditor>[email protected]</managingEditor> | ||
<webMaster>[email protected]</webMaster> | ||
<lastBuildDate>${new Date().toUTCString()}</lastBuildDate> | ||
<docs>https://www.rssboard.org/rss-specification</docs> | ||
<ttl>60</ttl> | ||
${posts.map(post => ` | ||
<item> | ||
<title>${escapeHTML(post.title)}</title> | ||
<link>${escapeHTML(`https://purplesyringa.moe/blog/${post.path}/`)}</link> | ||
<description>Here is some text containing an interesting description.</description> | ||
<author>[email protected]</author> | ||
${"" /* <comments>URL to hackernews</comments> */} | ||
<guid>${escapeHTML(`https://purplesyringa.moe/blog/${post.path}/`)}</guid> | ||
<pubDate>${post.parsedDate.toUTCString()}</pubDate> | ||
</item> | ||
`).join("")} | ||
</channel> | ||
</rss>`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<rss version="2.0"> | ||
<channel> | ||
<title>purplesyringa's blog</title> | ||
<link>https://purplesyringa.moe/blog/</link> | ||
<description>Posts from purplesyringa's blog.</description> | ||
<copyright>CC BY</copyright> | ||
<managingEditor>[email protected]</managingEditor> | ||
<webMaster>[email protected]</webMaster> | ||
<lastBuildDate>Tue, 13 Aug 2024 10:33:06 GMT</lastBuildDate> | ||
<docs>https://www.rssboard.org/rss-specification</docs> | ||
<ttl>60</ttl> | ||
|
||
<item> | ||
<title>You might want to use panics for error handling</title> | ||
<link>https://purplesyringa.moe/blog/./you-might-want-to-use-panics-for-error-handling/</link> | ||
<description>Here is some text containing an interesting description.</description> | ||
<author>[email protected]</author> | ||
|
||
<guid>https://purplesyringa.moe/blog/./you-might-want-to-use-panics-for-error-handling/</guid> | ||
<pubDate>Tue, 13 Aug 2024 00:00:00 GMT</pubDate> | ||
</item> | ||
|
||
<item> | ||
<title>У base64 есть неподвижная точка</title> | ||
<link>https://purplesyringa.moe/blog/ru/base64-has-a-fixed-point/</link> | ||
<description>Here is some text containing an interesting description.</description> | ||
<author>[email protected]</author> | ||
|
||
<guid>https://purplesyringa.moe/blog/ru/base64-has-a-fixed-point/</guid> | ||
<pubDate>Sat, 03 Aug 2024 00:00:00 GMT</pubDate> | ||
</item> | ||
|
||
<item> | ||
<title>Recovering garbled Bitcoin addresses</title> | ||
<link>https://purplesyringa.moe/blog/./recovering-garbled-bitcoin-addresses/</link> | ||
<description>Here is some text containing an interesting description.</description> | ||
<author>[email protected]</author> | ||
|
||
<guid>https://purplesyringa.moe/blog/./recovering-garbled-bitcoin-addresses/</guid> | ||
<pubDate>Tue, 23 Apr 2024 00:00:00 GMT</pubDate> | ||
</item> | ||
|
||
</channel> | ||
</rss> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.