Commit 14958653 authored by Yuval Adam's avatar Yuval Adam

Basic structure and initial homepage

\ No newline at end of file
## Dev
### Dev Server
$ FLASK_DEBUG=1 flask run
### Build
$ python
import markdown
from flask import Flask, render_template
from os import listdir
app = Flask(__name__)
BLOG_CONTENT_DIR = 'content/blog'
def home():
return render_template('index.html')
def parse_post(post):
y, m, d, *title = post[:-3].split('-')
slug = '-'.join(title)
return {'url': f'/blog/{y}/{m}/{d}/{slug}/', 'title': ' '.join(title)}
def blog():
posts = sorted(listdir(BLOG_CONTENT_DIR), reverse=True)
posts = map(parse_post, posts)
return render_template('blog.html', posts=posts)
def blog_post(y, m, d, title):
post_path = f'{y}-{m}-{d}-{title}'
with open(f'{BLOG_CONTENT_DIR}/{post_path}.md', 'r') as f:
text =
_, header, body = text.split('---')
for h in header:
if h.startswith('title'):
title = h.split('title:')[0].strip()
html = markdown.markdown(body, extensions=['markdown.extensions.extra', 'markdown.extensions.codehilite'])
return render_template('post.html', title=title, html=html)
from flask_frozen import Freezer
from app import app
freezer = Freezer(app)
if __name__ == '__main__':
p.intro {
font-size: 1.3em;
line-height: 1.3em;
This diff is collapsed.
<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8">
<title>{% block title %}postmarketOS{% endblock %}</title>
<meta name="description" content="Aiming for a 10 year life-cycle for smartphones">
<meta name="keywords" content="postmarketOS">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="all">
<link rel="canonical" href="{{ request.path }}">
<link href="{{ url_for('static', filename='css/tachyons.min.css') }}" rel="stylesheet">
<link href="{{ url_for('static', filename='css/main.css') }}" rel="stylesheet">
{% block body %}
{% endblock %}
{% extends 'base.html' %}
{% block body %}
<h1>{{ title }}</h1>
{{ html|safe }}
{% endblock %}
{% extends 'base.html' %}
{% block body %}
{% for post in posts %}
<li><a href="{{ post.url }}">{{ post.title }}</a></li>
{% endfor %}
{% endblock %}
{% extends 'base.html' %}
{% block body %}
<div class="mw7 center">
<div class="cf ph2-ns">
<h1 class="f2 lh-title">postmarketOS</h1>
<div class="fl w-100 w-50-ns pa2">
<img src="{{ url_for('static', filename='img/banner.jpg') }}"></img>
<div class="fl w-100 w-50-ns pa2">
<p class="intro">postmarketOS, or <i>pmOS</i> in short, is a touch-optimized, pre-configured <a href="">Alpine Linux</a> with own packages, that can be installed on smartphones (Not usable for most people yet!).</p>
{% endblock %}
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