Commit 273202b4 authored by Martijn Braam's avatar Martijn Braam

Generate /dark versions of pages

parent de189d00
......@@ -50,6 +50,7 @@ WIKI_REDIRECTS = {
def home():
return render_template('index.html')
......@@ -116,6 +117,7 @@ def get_posts(**kwargs):
return ret
def blog():
return render_template('blog.html',
......@@ -140,11 +142,13 @@ def atom():
return feed.get_response()
def blog_post(y, m, d, slug):
blog = parse_post('-'.join([y, m, d, slug]) + '.md')
return render_template('blog-post.html', **blog)
def static_page(page):
with open(os.path.join(PAGE_CONTENT_DIR, page + '.md'),
encoding="utf-8") as handle:
{% if request.path.startswith('/dark') %}{% set dark = '/dark' %}{% else %}{% set dark = '/' %}{% endif %}
<!DOCTYPE html>
<html lang="en">
......@@ -15,21 +16,25 @@
<link rel="canonical" href="{{ request.path }}">
<link rel="shortcut icon" href="/static/img/favicon.ico">
<link rel="stylesheet" href="/static/css/base.css">
<link rel="stylesheet" href="/static/css/dark.css" media="prefers-color-scheme: dark">
{% if request.path.startswith('/dark') %}
<link rel="stylesheet" href="/static/css/dark.css">
{% else %}
<link rel="stylesheet" href="/static/css/dark.css" media="prefers-color-scheme: dark">
{% endif %}
<link rel="stylesheet" href="/static/css/codehilite.css">
<link rel="alternate" type="application/atom+xml" title="postmarketOS Blog" href="{{ url_for('atom') }}">
{% block extra_link %}{% endblock %}
<header class="header">
<a class="logo" name="^" href="/">
<a class="logo" name="^" href="{{ dark }}">
<img src="/logo.svg">
<div class="nav">
<div class="nav-row1">
<a href="/blog">blog</a>
<a href="/faq.html">faq</a>
<a href="{{ dark }}/blog">blog</a>
<a href="{{ dark }}/faq.html">faq</a>
<a href="">wiki</a>
<a href="">src</a>
......@@ -70,7 +75,7 @@
<img src="/static/img/icons-numix/application-rss+xml-symbolic.svg">
<a href="/privacy-policy.html" class="icon-button">
<a href="{{ dark }}/privacy-policy.html" class="icon-button">
<img src="/static/img/icons-numix/changes-secure-symbolic.svg">
<span>privacy policy</span>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment