steve0greatness,
created on Thursday, 18 January 2024, 03:44:49 (1705549489),
received on Monday, 6 May 2024, 02:55:34 (1714964134)
Author identity: Steve0Greatness <75220768+Steve0Greatness@users.noreply.github.com>
4bb34c3da669cb5f72cd5abded38cf2681fae840
build.py
@@ -5,6 +5,7 @@ from os import mkdir as CreateDirectory, listdir as ListDirectory, unlink as Del
from os.path import isfile as IsFile, exists as PathExists from distutils.dir_util import copy_tree as CopyDirectory from datetime import datetime from json import dump as DumpJSONGITHUB_BUILD_DIR = "docs" # Separate because this site is built with an action that won't work if they aren't LOCAL_BUILD_DIR = "build"
@@ -91,6 +92,25 @@ def RenderPage(PageInput: str, ContentDest: str, AllowSitemap: bool = True, **kw
with open(BUILD_DIRECTORY + "/" + ContentDest, "w", encoding="utf-8") as DestLocation: DestLocation.write(RenderTemplate(PageInput, **kwargs)) def CreateJSONFeed(): CreatedJSON = { "version": "https://jsonfeed.org/version/1", "title": "Steve0Greatness' Blog", "home_page_url": "https://steve0greatness.github.io", "feed_url": "https://steve0greatness.github.io/blog/feed.rss", "items": [] } for post in PostList: CreatedJSON["items"].append({ "id": "https://steve0greatness.github.io/blog/" + post["pathname"], "title": "JSON Feed version 1.1", "content_html": post["content"], "date_published": post["date"], "url": "https://steve0greatness.github.io/blog/" + post["pathname"] }) with open("build/blog/feed.json", "w") as JSONFeedFile: DumpJSON(CreatedJSON, JSONFeedFile) if __name__ == "__main__": print("Wiping directory") WipeFinalDir()
@@ -98,6 +118,7 @@ if __name__ == "__main__":
CreateDirectory(BUILD_DIRECTORY + "/blog") print("Rendering posts") RenderPosts() CreateJSONFeed()print("Copying static directory") CopyDirectory("static", BUILD_DIRECTORY)
static/JSONFeed.png
views/blog-list.html
@@ -2,6 +2,7 @@
{% block Head %} {{super()}} <link rel="alternate" href="/blog/feed.rss" type="application/rss+xml" title="Steve0Greatness' Blog" /> <link rel="alternate" href="/blog/feed.json" type="application/feed+json" title="Steve0Greatness' Blog" /><link rel="stylesheet" href="/src/blog.css" /> <meta property="og:title" content="Blog index" /> <meta property="og:url" content="https://steve0greatness.github.io/blog/" />
@@ -13,6 +14,7 @@
<h1>Blog Posts</h1> <div role="toolbar" class="toolbar"> <a href="/blog/feed.rss"><img src="/rss-feed.png" width="16" height="16" alt="RSS Feed"></a> <a href="/blog/feed.json"><img src="/JSONFeed.png" width="16" height="16" alt="JSON Feed"></a></div> <table class="blog-list"> <tbody>