diff options
| -rw-r--r-- | blog/templates/blog_feed.xml.j2 (renamed from blog/templates/feed.xml.j2) | 2 | ||||
| -rw-r--r-- | comic/assets/css/comic.css | 26 | ||||
| -rw-r--r-- | comic/assets/images/banner_placeholder.png | bin | 0 -> 13661 bytes | |||
| -rw-r--r-- | comic/templates/comic_feed.xml.j2 | 24 | ||||
| -rw-r--r-- | comic/templates/issue.html.j2 | 10 | ||||
| -rw-r--r-- | modules/blog_generate.py | 2 | ||||
| -rw-r--r-- | modules/comic_generate.py | 17 |
7 files changed, 75 insertions, 6 deletions
diff --git a/blog/templates/feed.xml.j2 b/blog/templates/blog_feed.xml.j2 index 7e51092..1133d85 100644 --- a/blog/templates/feed.xml.j2 +++ b/blog/templates/blog_feed.xml.j2 @@ -11,7 +11,7 @@ <title>{{ post.title() }}</title> <link>{{ post.get_link() }}</link> <description>{{ post.intro }}</description> - <guid isPermaLink="false">{{ post.get_link() }}</guid> + <guid>{{ post.get_link() }}</guid> <author>contact@wazul.moe</author> <pubDate>{{ post.get_publish_time_rfc2822() }}</pubDate> </item> diff --git a/comic/assets/css/comic.css b/comic/assets/css/comic.css index f571a16..9449cab 100644 --- a/comic/assets/css/comic.css +++ b/comic/assets/css/comic.css @@ -21,6 +21,20 @@ main, footer { margin-top: 0.5rem; } +footer { + padding-top: 1rem !important; + padding-bottom: 1rem !important;; +} + +hr { + width: 30%; + color: #e9d3ff; +} + +img.banner { + width: 100%; +} + img.comic { width: 100%; border: 0.1rem solid black; @@ -31,6 +45,16 @@ p { margin: 0.2rem; } +a { + color: #801396; + text-decoration: none; +} + +a:hover { + text-decoration: underline; +} + p.description { - margin-top: 3rem; + margin-top: 2rem; + margin-bottom: 2rem; }
\ No newline at end of file diff --git a/comic/assets/images/banner_placeholder.png b/comic/assets/images/banner_placeholder.png Binary files differnew file mode 100644 index 0000000..64bff87 --- /dev/null +++ b/comic/assets/images/banner_placeholder.png diff --git a/comic/templates/comic_feed.xml.j2 b/comic/templates/comic_feed.xml.j2 new file mode 100644 index 0000000..eeb177d --- /dev/null +++ b/comic/templates/comic_feed.xml.j2 @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<rss version="2.0"> +<channel> + <title>{{ comic.comic_name }}</title> + <link>https://comic.wazul.moe/feed.xml</link> + <description>Silly comic ideas by Wazul</description> + <language>en</language> + <lastBuildDate>{{ build_date }}</lastBuildDate> + {% for issue in issues %} + <item> + <title>{{ issue.title() }}</title> + <link>{{ issue.get_link() }}</link> + <description> + <img src="{{ issue.get_link() }}/comic.png"/> + <br> + <p>{{ issue.description() }}</p> + </description> + <guid>{{ issue.get_link() }}</guid> + <author>contact@wazul.moe</author> + <pubDate>{{ issue.get_publish_time_rfc2822() }}</pubDate> + </item> + {% endfor %} + </channel> +</rss>
\ No newline at end of file diff --git a/comic/templates/issue.html.j2 b/comic/templates/issue.html.j2 index 7eca898..70b4745 100644 --- a/comic/templates/issue.html.j2 +++ b/comic/templates/issue.html.j2 @@ -14,12 +14,12 @@ <div class="bootstrap-wrapper"> <div class="container"> <a href="/" class="row dont-bother"> - <header class="col-md-7" role="banner">TITLE</header> + <header class="col-md-7" role="banner"><img class="banner" src="{{ site.assets_path }}/images/banner_placeholder.png" alt="banner"/></header> </a> <div class="row"> <main class="col-md-7"> <h1>{{ issue.title() }}</h1> - <img class="comic" src="{{ url }}/comic.png" /> + <img class="comic" src="{{ url }}/comic.png" alt="comic"/> <p class="description">{{ issue.description() }}</p> </main> </div> @@ -27,6 +27,12 @@ <footer class="col-md-7"> <p>Permalink to this comic: <a href="{{ url }}">{{ url }}</a></p> <p>Image url: <a href="{{ url }}/comic.png">{{ url }}/comic.png</a></p> + <hr> + <p><a href="/feed.xml">RSS feed</a></p> + <hr> + <p>This comic series is heavily inspired by <a href="https://xkcd.com">XKCD</a></p> + <hr> + <p>The comic is licenced under <a href="https://creativecommons.org/licenses/by-nc/4.0/legalcode.en">Creative Commons Attribution-NonCommercial 4.0</a></p> </footer> </div> </div> diff --git a/modules/blog_generate.py b/modules/blog_generate.py index 04bd673..904050d 100644 --- a/modules/blog_generate.py +++ b/modules/blog_generate.py @@ -98,7 +98,7 @@ def generate(jinja_env: jinja2.Environment, output_root_path: str, local: bool): with open(os.path.join(output_root_path, "acknowledgement.html"), "w") as f: f.write(acknowledgement_template.render({})) - rss_template = jinja_env.get_template("feed.xml.j2") + rss_template = jinja_env.get_template("blog_feed.xml.j2") ctx = { "build_date": email.utils.format_datetime(datetime.datetime.now(Config.TIMEZONE)), "posts": posts[:5] diff --git a/modules/comic_generate.py b/modules/comic_generate.py index 9c88d67..76705fa 100644 --- a/modules/comic_generate.py +++ b/modules/comic_generate.py @@ -33,6 +33,12 @@ class Issue: def get_publish_time(self) -> str: return self.meta_data[PUBLISH_DATE_KEY] + def get_publish_time_rfc2822(self) -> str: + return email.utils.format_datetime(datetime.datetime.fromisoformat(self.get_publish_time() + " 12:00+02:00")) + + def get_link(self) -> str: + return f"{Config.COMIC_ROOT_URL}/issues/{self.index}" + def get_issues(path: str, local: bool) -> list[Issue]: return_list = [] @@ -55,6 +61,7 @@ def generate(jinja_env: jinja2.Environment, output_root_path: str, local: bool): jinja_env.globals.update(comic={ "comic_name": Config.COMIC_NAME, + "comic_url": Config.COMIC_ROOT_URL, }) issues = get_issues(Config.ISSUE_SOURCE_DIR, local) @@ -67,7 +74,7 @@ def generate(jinja_env: jinja2.Environment, output_root_path: str, local: bool): ctx = { "issue": issue, - "url": f"{Config.COMIC_ROOT_URL}/issues/{issue.index}" + "url": issue.get_link() } last_render = issue_template.render(ctx) @@ -80,3 +87,11 @@ def generate(jinja_env: jinja2.Environment, output_root_path: str, local: bool): f.write(last_render) shutil.copytree(Config.COMIC_ASSETS_SOURCE_DIR, output_root_path + Config.ASSETS_IMPORT_PATH) + rss_template = jinja_env.get_template("comic_feed.xml.j2") + ctx = { + "build_date": email.utils.format_datetime(datetime.datetime.now(Config.TIMEZONE)), + "issues": issues[:5] + } + with open(os.path.join(output_root_path, "feed.xml"), "w") as f: + f.write(rss_template.render(ctx)) + |
