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

Generate /dark versions of pages

parent de189d00
......@@ -50,6 +50,7 @@ WIKI_REDIRECTS = {
@app.route('/')
@app.route('/dark')
def home():
return render_template('index.html')
......@@ -116,6 +117,7 @@ def get_posts(**kwargs):
return ret
@app.route('/blog/')
@app.route('/dark/blog/')
def blog():
return render_template('blog.html',
year_posts=get_posts(create_html=False))
......@@ -140,11 +142,13 @@ def atom():
return feed.get_response()
@app.route('/blog/<y>/<m>/<d>/<slug>/')
@app.route('/dark/blog/<y>/<m>/<d>/<slug>/')
def blog_post(y, m, d, slug):
blog = parse_post('-'.join([y, m, d, slug]) + '.md')
return render_template('blog-post.html', **blog)
@app.route('/<page>.html')
@app.route('/dark/<page>.html')
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">
<head>
......@@ -15,21 +16,25 @@
<link rel="canonical" href="https://postmarketos.org{{ 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 %}
</head>
<body>
<header class="header">
<a class="logo" name="^" href="/">
<a class="logo" name="^" href="{{ dark }}">
<img src="/logo.svg">
<span>postmarketOS</span>
</a>
<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="https://wiki.postmarketos.org">wiki</a>
<a href="https://gitlab.com/postmarketOS">src</a>
</div>
......@@ -70,7 +75,7 @@
<img src="/static/img/icons-numix/application-rss+xml-symbolic.svg">
<span>feed</span>
</a>
<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>
</a>
......
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