Create gutenberg templates

This commit is contained in:
Philipp Oppermann
2017-05-02 08:49:50 +02:00
parent d109912798
commit 168b598901
6 changed files with 158 additions and 0 deletions

41
blog/templates/base.html Normal file
View File

@@ -0,0 +1,41 @@
<!doctype html>
<html lang="{{ config.language_code }}">
<head>
<meta charset="UTF-8">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="{{ config.description }}">
<meta name="author" content="{{ config.extra.author.name }}">
<link href="/css/poole.css" rel="stylesheet">
<link href="/css/main.css" rel="stylesheet">
<title>{% block title %}{% endblock title %}</title>
</head>
<body>
<div class="container content">
<header class="masthead">
<h3 class="masthead-title">
<a href="/" title="Home">{{ config.title }}</a>
<small>{{ config.extra.subtitle }}</small>
</h3>
</header>
<main>{% block main %}{% endblock main %}</main>
<div>{% block after_main %}{% endblock after_main %}</div>
<footer class="footer">
<hr>
<small>
&copy; <time datetime="2017">2017</time>. All rights reserved.
<a href="/contact.html">Contact</a>
</small>
</footer>
</div>
</body>
</html>

View File

@@ -0,0 +1,11 @@
{% extends "section.html" %}
{% block title %}{{ super() }}{% endblock title %}
{% block main %}{{ super() }}{% endblock main %}
{% block introduction %}
<p>These posts explain how to handle CPU exceptions using naked functions. Historically, these posts were the main exception handling posts before the <code>x86-interrupt</code> calling convention and the <code>x86_64</code> crate existed. Our new way of handling exceptions can be found in the <a href="/handling-exceptions.html">“Handling Exceptions”</a> post.</p>
{% endblock introduction %}

54
blog/templates/index.html Normal file
View File

@@ -0,0 +1,54 @@
{% extends "base.html" %}
{% import "macros.html" as macros %}
{% block title %}{{ config.title }}{% endblock title %}
{% block main %}
<div class="front-page-introduction">
<p>
This blog series creates a small operating system in the
<a href="https://www.rust-lang.org/">Rust programming language</a>. Each post is a small tutorial and includes all
needed code, so you can follow along if you like. The source code is also available in the corresponding
<a href="https://github.com/phil-opp/blog_os">Github repository</a>.
</p>
<p>Latest post:
<strong>{{ macros::latest_post_link(page=pages|reverse|last) }}</strong>
</p>
</div>
<div id="bare-bones" class="post-category bare-bones">Bare Bones</div>
<div class="posts bare-bones">
{{ macros::post_link(page=pages.9) }}
{{ macros::post_link(page=pages.8) }}
{{ macros::post_link(page=pages.7) }}
{{ macros::post_link(page=pages.6) }}
</div>
<div id="memory-management" class="post-category memory-management">Memory Management</div>
<div class="posts memory-management">
{{ macros::post_link(page=pages.5) }}
{{ macros::post_link(page=pages.4) }}
{{ macros::post_link(page=pages.3) }}
{{ macros::post_link(page=pages.2) }}
</div>
<div id="interrupts" class="post-category exceptions">Exceptions</div>
<div class="posts exceptions">
{{ macros::post_link(page=pages.1) }}
{{ macros::post_link(page=pages.0) }}
</div>
<hr>
<h1>Additional Resources</h1>
<ul>
</ul>
<hr>
<aside id="recent-updates">
<h1>Recent Updates</h1>
TODO
</aside>
{% endblock main %}

View File

@@ -0,0 +1,10 @@
{% macro post_link(page) %}
<article>
<h2 class="post-title"><a href="{{ page.path }}">{{ page.title }}</a></h2>
{{ page.summary | safe }}
</article>
{% endmacro post_link %}
{% macro latest_post_link(page) %}
<a href="{{ page.path }}">{{ page.title }}</a>
{% endmacro latest_post_link %}

23
blog/templates/page.html Normal file
View File

@@ -0,0 +1,23 @@
{% extends "base.html" %}
{% block title %}{{ page.title }} | {{ config.title }}{% endblock title %}
{% block main %}
<h1>{{ page.title }}</h1>
{{ page.content | safe }}
{% endblock main %}
{% block after_main %}
<hr>
<div class="PageNavigation">
{% if page.previous %}
<a class="prev" href="{{ page.previous.path }}">&laquo; {{ page.previous.title }}</a>
{% endif %}
{% if page.next %}
<a class="next" href="{{ page.next.path }}">{{ page.next.title }} &raquo;</a>
{% endif %}
</div>
{% endblock after_main %}

View File

@@ -0,0 +1,19 @@
{% extends "base.html" %}
{% import "macros.html" as macros %}
{% block title %}{{ section.title }} | {{ config.title }}{% endblock title %}
{% block main %}
<h1>{{ section.title }}</h1>
{% block introduction %}{% endblock introduction %}
<div class="posts neutral">
{% for page in section.pages %}
{{ macros::post_link(page=page) }}
{% endfor %}
</div>
{% endblock main %}