From 9d0a78bd95d3efdf6085581876b608d20d697eab Mon Sep 17 00:00:00 2001 From: Yuval Adam <_@yuv.al> Date: Mon, 7 Aug 2017 15:27:16 +0300 Subject: Add intro blog post and logo in header --- app.py | 10 +++++----- static/css/main.css | 8 ++++++++ static/img/recycle.png | Bin 0 -> 3502 bytes templates/base.html | 5 ++++- templates/blog-post.html | 2 +- templates/index.html | 3 ++- 6 files changed, 20 insertions(+), 8 deletions(-) create mode 100644 static/img/recycle.png diff --git a/app.py b/app.py index 97fe702..fc4ab4a 100644 --- a/app.py +++ b/app.py @@ -23,15 +23,15 @@ def blog(): posts = map(parse_post, posts) return render_template('blog.html', posts=posts) -@app.route('/blog/////') -def blog_post(y, m, d, title): - post_path = f'{y}-{m}-{d}-{title}' +@app.route('/blog/<y>/<m>/<d>/<slug>/') +def blog_post(y, m, d, slug): + post_path = f'{y}-{m}-{d}-{slug}' with open(f'{BLOG_CONTENT_DIR}/{post_path}.md', 'r') as f: text = f.read() _, header, body = text.split('---') - for h in header: + for h in header.split('\n'): if h.startswith('title'): - title = h.split('title:')[0].strip() + title = h.split('title:')[1].strip() html = markdown.markdown(body, extensions=['markdown.extensions.extra', 'markdown.extensions.codehilite']) return render_template('blog-post.html', title=title, html=html) diff --git a/static/css/main.css b/static/css/main.css index f70346b..57d46bc 100644 --- a/static/css/main.css +++ b/static/css/main.css @@ -1,3 +1,11 @@ +h1 img { + height: 1.4em; +} + +h1 span { + vertical-align: top; +} + div.menu ul { list-style: none; padding-left: 7px; diff --git a/static/img/recycle.png b/static/img/recycle.png new file mode 100644 index 0000000..7e4aa88 Binary files /dev/null and b/static/img/recycle.png differ diff --git a/templates/base.html b/templates/base.html index 06e79d4..a5cce9f 100644 --- a/templates/base.html +++ b/templates/base.html @@ -21,7 +21,10 @@ <body> <div class="mw7 center"> <div class="cf ph2-ns"> - <h1 class="f2 lh-title">postmarketOS</h1> + <h1 class="f2 lh-title"> + <img src="{{ url_for('static', filename='img/recycle.png') }}"></img> + <span>postmarketOS</span> + </h1> <div class="menu"> <ul> <li><a href="/">Home</a></li> diff --git a/templates/blog-post.html b/templates/blog-post.html index 7a24d02..9515768 100644 --- a/templates/blog-post.html +++ b/templates/blog-post.html @@ -1,6 +1,6 @@ {% extends 'base.html' %} {% block body %} -<h1>{{ title }}</h1> +<h2>{{ title }}</h2> {{ html|safe }} {% endblock %} diff --git a/templates/index.html b/templates/index.html index 59c14e9..fd11861 100644 --- a/templates/index.html +++ b/templates/index.html @@ -5,7 +5,8 @@ <img src="{{ url_for('static', filename='img/banner.jpg') }}"></img> </div> <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="https://alpinelinux.org">Alpine Linux</a> with own packages, that can be installed on smartphones (Not usable for most people yet!).</p> + <p class="intro">postmarketOS (<i>pmOS</i>), is a touch-optimized, pre-configured <a href="https://alpinelinux.org">Alpine Linux</a> that can be installed on smartphones and other mobile devices. The project is at very early stages of development and is not yet usable for most users.</p> + <p class="intro">For further details read our <a href="/blog/2017/05/26/intro/">introductory blog post</a>.</p> <p>Find us on:</p> <ul> <li><a href="https://github.com/postmarketOS">GitHub</a></li> -- cgit v1.3.1