Skip to content

Commit ba4a541

Browse files
committed
Add a separate template for showcase posts
1 parent 1434215 commit ba4a541

File tree

3 files changed

+53
-1
lines changed

3 files changed

+53
-1
lines changed

content/showcase/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
+++
22
title = "Showcase"
33
sort_by = "date"
4-
render = false
4+
page_template = "showcase.html"
55
+++
66

77
In this section, we present interesting operating system projects written in Rust. Feel free to add your own project by [creating a pull request](https://github.com/rust-osdev/homepage/pulls).

templates/showcase.html

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{% extends "base.html" %}
2+
3+
{% import "snippets.html" as snippets %}
4+
5+
{% block title %}{{ page.title | striptags }} | {{ config.title }}{% endblock title %}
6+
7+
{% block main %}
8+
<h1>{{ page.title | safe}}</h1>
9+
10+
<span class="post-authors post-date">Written by
11+
{% for author in page.extra.authors -%}
12+
{%- if not loop.first -%}
13+
{%- if loop.last %}{% if loop.index0 > 1 %}, and {% else %} and {% endif %}{% else %}, {% endif -%}
14+
{%- endif -%}
15+
<a href="https://github.com/{{ author }}">@{{ author }}</a>
16+
{%- endfor %}
17+
18+
<br>Published on <time datetime="{{ page.date | date(format="%Y-%m-%d") }}">
19+
{{ page.date | date(format="%b %d, %Y") }}
20+
{% if page.extra.updated %} (updated on {{ page.extra.updated | date(format="%b %d, %Y") }}) {% endif %}
21+
</time>
22+
</span>
23+
24+
{{ page.content | replace(from="<!-- showcase-intro -->", to=snippets::showcase_intro()) | safe }}
25+
26+
<h2 id="comment-form">Comments</h2>
27+
28+
<script src="https://utteranc.es/client.js"
29+
repo="rust-osdev/homepage"
30+
issue-term="url"
31+
theme="github-light"
32+
crossorigin="anonymous"
33+
async>
34+
</script>
35+
{% endblock main %}
36+
37+
{% block after_main %}
38+
<hr>
39+
<div class="PageNavigation">
40+
{% if page.earlier %}
41+
<a class="prev" href="{{ page.earlier.path | safe }}">&laquo; {{ page.earlier.title }}</a>
42+
{% endif %}
43+
{% if page.later %}
44+
<a class="next" href="{{ page.later.path | safe }}">{{ page.later.title }} &raquo;</a>
45+
{% endif %}
46+
</div>
47+
{% endblock after_main %}

templates/snippets.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{% macro showcase_intro() %}
2+
<aside class="showcase-post-intro"><p>
3+
This post is part of our <a href="{{ get_url(path="@/showcase/_index.md") }}"><strong>Showcase</strong></a> series, where we present interesting projects in the Rust OSDev ecosystem. Feel free to add your own project by <a href="https://github.com/rust-osdev/homepage/pulls">creating a pull request</a> if you like.
4+
</p></aside>
5+
{% endmacro showcase_intro %}

0 commit comments

Comments
 (0)