Add custom templates for second edition posts

This commit is contained in:
Philipp Oppermann
2017-10-10 12:34:10 +02:00
parent 75b4e09c4e
commit 7a263355f3
4 changed files with 156 additions and 0 deletions

View File

@@ -228,3 +228,11 @@ a.gutenberg-anchor {
a.gutenberg-anchor:hover {
text-decoration: none;
}
div.warning {
padding: .7rem 1rem;
margin: 1rem .2rem;
border: 2px solid orange;
border-radius: 5px;
background-color: #ffa50022;
}

View File

@@ -0,0 +1,59 @@
<!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">
<script async src="/js/main.js"></script>
<title>{% block title %}{% endblock title %}</title>
</head>
<body>
<div class="container content">
<header class="masthead">
<h1 class="masthead-title">
<a href="/" title="Home">{{ config.title }}</a>
</h1>
<p><small>{{ config.extra.subtitle }}</small></p>
</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="{{ get_url(path="./pages/contact.md") }}">Contact</a>
</small>
</footer>
</div>
<!-- Piwik -->
<script type="text/javascript">
var _paq = _paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//analytics.phil-opp.com/";
_paq.push(['setTrackerUrl', u+'js/']);
_paq.push(['setSiteId', '1']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src='https://cdnjs.cloudflare.com/ajax/libs/piwik/3.0.4/piwik.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<!-- End Piwik Code -->
</body>
</html>

View File

@@ -0,0 +1,38 @@
{% extends "second-edition/base.html" %}
{% import "macros.html" as macros %}
{% block title %}{{ config.title }}{% endblock title %}
{% block main %}
{% set posts_section = get_section(path = "second-edition/posts/_index.md") %}
{% set posts = posts_section.pages | reverse %}
<div class="warning">
<b>Note:</b> You are viewing the upcoming second edition of “Writing an OS in Rust”, which is still under construction. To read the first edition, go <a href="{{ get_url(path = "/") }}">here</a>.
</div>
<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:
{% set latest_post = posts|last %}
<strong><a href="{{ latest_post.permalink | safe }}">{{ latest_post.title }}</a></strong>
</p>
</div>
<div id="bare-bones" class="post-category bare-bones">Bare Bones</div>
<div class="posts bare-bones">
{{ macros::post_link(page=posts.0) }}
{{ macros::post_link(page=posts.1) }}
{{ macros::post_link(page=posts.2) }}
</div>
<aside id="recent-updates">
<h2>Recent Updates</h2>
{% include "recent-updates.html" %}
</aside>
{% endblock main %}

View File

@@ -0,0 +1,51 @@
{% extends "second-edition/base.html" %}
{% block title %}{{ page.title }} | {{ config.title }}{% endblock title %}
{% block main %}
<h1>{{ page.title }}</h1>
<time datetime="{{ page.date | date(format="%Y-%m-%d") }}" class="post-date">
{{ page.date | date(format="%b %d, %Y") }}
{% if page.extra.updated %} (updated on {{ page.extra.updated | date(format="%b %d, %Y") }}) {% endif %}
</time>
<aside id="toc">
<h2>Table of Contents</h2>
<ol>
{% for h2 in page.toc %}<li>
<a href="{{h2.permalink | safe}}">{{ h2.title | safe }}</a>
{% if h2.children %}<ol>
{% for h3 in h2.children %}<li>
<a href="{{h3.permalink | safe}}">{{ h3.title | safe }}</a>
</li>{% endfor %}
</ol>{% endif %}
</li>{% endfor %}
</ol>
</aside>
<div class="warning">
<b>Note:</b> This post is part of the upcoming <a href="{{ get_url(path = "./second-edition/_index.md") }}">second edition</a> of “Writing an OS in Rust”, which is still under construction. To read the first edition, go <a href="{{ get_url(path = "/") }}">here</a>.
</div>
{{ page.content | safe }}
{% endblock main %}
{% block after_main %}
<hr>
<div class="PageNavigation">
{% if page.previous %}
<a class="prev" href="{{ page.previous.permalink | safe }}">&laquo; {{ page.previous.title }}</a>
{% endif %}
{% if page.next %}
<a class="next" href="{{ page.next.permalink | safe }}">{{ page.next.title }} &raquo;</a>
{% endif %}
</div>
<hr>
<script data-isso="//comments.phil-opp.com/fcgi-bin/isso"
src="//comments.phil-opp.com/fcgi-bin/isso/js/embed.min.js"></script>
<section>
<h2>Comments</h2>
<section id="isso-thread"></section>
</section>
{% endblock after_main %}