Skip to content

Commit 253915b

Browse files
committed
Update from Liquid to Jinja templating
1 parent 773dd40 commit 253915b

File tree

6 files changed

+189
-60
lines changed

6 files changed

+189
-60
lines changed

_layouts/_includes/latest-posts.html

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,43 @@
1-
{%- if page.list_title -%}
2-
<h2 class="post-list-heading">{{ page.list_title }}</h2>
3-
{% endif %}
1+
2+
{% block content %}
3+
{% for page in pages %}
4+
{%- if page.list_title -%}
5+
<h2 class="post-list-heading">{{ list_title }}</h2>
6+
{% endif %}
47
<article class="post-list">
58
<div>
69
<h3>
7-
<a class="" href="{{ post.url }}"> {{ post.title | escape }} </a>
10+
<a class="" href="{{ url }}"> {{ title | escape }} </a>
811
</h3>
9-
<p>{{ post.date }}</p>
12+
<p>{{ date }}</p>
1013
{%- if site.show_excerpts -%}
11-
<p class="post-description" style="margin-bottom: 2rem">{{ post.description}}</p>
14+
<p class="post-description" style="margin-bottom: 2rem">{{ description}}</p>
1215
</div>
1316
</article>
1417

1518
<div class="pager">
1619
<ul class="pagination">
1720
{%- if paginator.previous_page %}
18-
<li><a href="{{ paginator.previous_page_path | relative_url }}" class="previous-page">{{ paginator.previous_page }}</a></li>
21+
<li><a href="{{ paginator.previous_page_path | relative_url }}" class="previous-page">{{ paginator.previous_page
22+
}}</a></li>
1923
{%- else %}
20-
<li><div class="pager-edge"></div></li>
24+
<li>
25+
<div class="pager-edge"></div>
26+
</li>
2127
{%- endif %}
22-
<li><div class="current-page">{{ paginator.page }}</div></li>
28+
<li>
29+
<div class="current-page">{{ paginator.page }}</div>
30+
</li>
2331
{%- if paginator.next_page %}
2432
<li><a href="{{ paginator.next_page_path | relative_url }}" class="next-page">{{ paginator.next_page }}</a></li>
2533
{%- else %}
26-
<li><div class="pager-edge"></div></li>
34+
<li>
35+
<div class="pager-edge"></div>
36+
</li>
2737
{%- endif %}
2838
</ul>
2939
</div>
3040
{%- endif %}
41+
42+
{% endfor %}
43+
{% endblock %}

_layouts/_includes/newsletter_form.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<article>
2-
<h3>{{include.newsletter_title}}</h3>
2+
<h3>{{newsletter_title}}</h3>
33
<form action="https://buttondown.email/api/emails/embed-subscribe/black-python-devs" method="post" target="popupwindow" onsubmit="window.open('https://buttondown.email/black-python-devs', 'popupwindow')">
44
<fieldset role="group">
55
<input type="email" name="email" id="bd-email" placeholder="Enter your email" />

_layouts/_includes/partnerships.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ <h2>Partnerships</h2>
44
<p>We're happy to share with you our proud sponsors who offer their products at discounted rates and a portion of proceeds go to support Black Python Devs!</p>
55

66
<div class="grid">
7-
{% for partner in site.data.partnerships %}
7+
{% for partner in partnerships %}
88
<article>
99
<div class="grid">
1010
<div>
11-
<img src="{{partner.logo}}" alt="{{partner.name}} Logo" style="max-height: 14em" />
11+
<img src="{{logo}}" alt="{{name}} Logo" style="max-height: 14em" />
1212
</div>
1313
<div>
14-
<h3><a href="{{partner.url}}">{{ partner.name }}</a></h3>
15-
<p>{{ partner.description }}</p>
16-
<a href="{{ partner.url }}">Learn more</a>
14+
<h3><a href="{{url}}">{{ name }}</a></h3>
15+
<p>{{ description }}</p>
16+
<a href="{{ url }}">Learn more</a>
1717
</div>
1818
</div>
1919
</article>

_layouts/post.html

Lines changed: 27 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,41 @@
1-
---
2-
layout: default
3-
---
1+
{% extends "default.html" %}
2+
43
<section>
5-
{%- if page.featured_image -%}
6-
<div class="hero-banner">
7-
<img src="{{page.featured_image}}" class="featured-image" alt="author image">
8-
</div>
9-
{%- else -%}
10-
<div class="hero-banner">
11-
<img src="/assets/images/bpd_stacked.png" class="featured-image" alt="Hero image">
12-
</div>
13-
{%- endif -%}
4+
{%- if featured_image -%}
5+
<div class="hero-banner">
6+
<img src="{{ featured_image }}" class="featured-image" alt="author image">
7+
</div>
8+
{%- else -%}
9+
<div class="hero-banner">
10+
<img src="/assets/images/bpd_stacked.png" class="featured-image" alt="Hero image">
11+
</div>
12+
{%- endif -%}
1413
<article class="post h-entry" itemscope itemtype="http://schema.org/BlogPosting">
1514
<header class="post-header">
16-
<h1 class="post-title p-name" itemprop="name headline">{{ page.title | escape }}</h1>
15+
<h1 class="post-title p-name" itemprop="name headline">{{ title|e }}</h1>
1716
<p class="post-meta">
18-
{%- assign date_format = site.bpdevs.date_format | default: "%b %-d, %Y" -%}
19-
<time class="dt-published" datetime="{{ page.date | date_to_xmlschema }}" itemprop="datePublished">
20-
{{ page.date | date: date_format }}
21-
</time>
22-
{%- if page.modified_date -%}
23-
~
24-
{%- assign mdate = page.modified_date | date_to_xmlschema -%}
25-
<time class="dt-modified" datetime="{{ mdate }}" itemprop="dateModified">
26-
{{ mdate | date: date_format }}
27-
</time>
28-
{%- endif -%}
29-
{%- if page.author -%}
30-
• {% for author in page.author %}
17+
{%- for author in author %}
3118
<span itemprop="author" itemscope itemtype="http://schema.org/Person">
32-
<span class="p-author h-card" itemprop="name">{{ author }}</span></span>
33-
{%- if forloop.last == false %}, {% endif -%}
34-
{% endfor %}
35-
{%- endif -%}
19+
<span class="p-author h-card" itemprop="name">{{ author }}</span>
20+
</span>
21+
{%- if not loop.last %}, {% endif -%}
22+
{%- endfor -%}
23+
3624
</p>
3725
</header>
3826
<div class="post-content e-content" itemprop="articleBody">
3927
{{ content }}
4028
</div>
41-
<a class="u-url" href="{{ page.url | relative_url }}" hidden></a>
4229
</article>
4330
</section>
4431

45-
{% assign author = site.data.authors | where:"name", page.author | first %}
32+
{% set author = authors | selectattr("name", "equalto", author) | first %}
4633
<section>
47-
{% if author.bio %}
48-
<hr />
49-
<h3>About {{author.name}}</h3>
50-
<p>{{author.bio}}</p>
51-
</section>
52-
{% endif %}
34+
{% if author and author.bio %}
35+
<hr />
36+
<h3>About {{author.name}}</h3>
37+
<p>{{author.bio|e}}</p>
38+
</section>
39+
{% endif %}
40+
41+
{% endblock %}

app.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
from render_engine import Site, Page, Collection
1+
from render_engine import Site, Page, Collection, Blog
2+
from render_engine_markdown import MarkdownPageParser
23

34
navigation = [
45
{"text": "Home", "url": "/index.html", "fa": "fa fa-home fa-fw"},
5-
{"text": "Blog", "url": "/blog.html", "fa": "fa fa-newspaper fa-fw"},
6+
{"text": "Blog", "url": "/blog", "fa": "fa fa-newspaper fa-fw"},
67
{"text": "About Us", "url": "/about.html", "fa": "fa fa-info-circle fa-fw"},
7-
{"text": "Events", "url": "/events.html", "fa": "fa fa-calendar fa-fw"},
8+
{"text": "Events", "url": "/events", "fa": "fa fa-calendar fa-fw"},
89
{"text": "Community", "url": "/community.html", "fa": "fa fa-users fa-fw"},
910
{"text": "Support Us", "url": "/support.html", "fa": "fa-solid fa-money-check-dollar"},
1011
]
@@ -25,6 +26,7 @@ class Index(Page):
2526
class About(Page):
2627
content_path = "pages/about.html"
2728
template = "default.html"
29+
routes = ["about"]
2830

2931

3032
@app.collection
@@ -34,3 +36,14 @@ class Events(Collection):
3436
routes = ["./events"]
3537
has_archive = True
3638
archive_template = "event-list.html"
39+
40+
@app.collection
41+
class Blog(Blog):
42+
Parser = MarkdownPageParser
43+
subcollections = ["tags"]
44+
template = "default.html"
45+
routes = ["./blog"]
46+
has_archive = True
47+
items_per_page = 20
48+
content_path = "_posts"
49+

output/index.html

Lines changed: 117 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ <h1 class="site-title"><a class="logo-text" href="/index.html"><img src="assets/
2020
<a class="nav-current" href="/index.html"> <i class="fa fa-home fa-fw" aria-hidden="true"></i>&nbsp;Home </a>
2121
</li>
2222
<li class="menu-item " role="menuitem">
23-
<a class="" href="/blog.html"> <i class="fa fa-newspaper fa-fw" aria-hidden="true"></i>&nbsp;Blog </a>
23+
<a class="" href="/blog"> <i class="fa fa-newspaper fa-fw" aria-hidden="true"></i>&nbsp;Blog </a>
2424
</li>
2525
<li class="menu-item " role="menuitem">
2626
<a class="" href="/about.html"> <i class="fa fa-info-circle fa-fw" aria-hidden="true"></i>&nbsp;About Us </a>
2727
</li>
2828
<li class="menu-item " role="menuitem">
29-
<a class="" href="/events.html"> <i class="fa fa-calendar fa-fw" aria-hidden="true"></i>&nbsp;Events </a>
29+
<a class="" href="/events"> <i class="fa fa-calendar fa-fw" aria-hidden="true"></i>&nbsp;Events </a>
3030
</li>
3131
<li class="menu-item " role="menuitem">
3232
<a class="" href="/community.html"> <i class="fa fa-users fa-fw" aria-hidden="true"></i>&nbsp;Community </a>
@@ -49,7 +49,11 @@ <h1 class="site-title"><a class="logo-text" href="/index.html"><img src="assets/
4949
<span class="icon-menu" aria-hidden="true"></span>
5050
</button>
5151
</header><main class="container" role="main" aria-label="Content">
52-
<h2>Our Mission</h2>
52+
53+
<div class="home">
54+
55+
56+
<h2>Our Mission</h2>
5357
<div class="grid hero-section">
5458
<article class="pico-background-sand-100">
5559
<h3>Secure the bag</h3>
@@ -75,6 +79,116 @@ <h3 class="pico-color-pumpkin-50">Say it loud!</h3>
7579

7680
<hr />
7781

82+
83+
84+
<div class="grid">
85+
<article id="join-us">
86+
<h2>Not a member yet?</h2>
87+
<p>Are you a Black Python Developer</p>
88+
<div class="grid">
89+
<a href="https://discord.gg/XUc3tFqCT3" role="button" class="pico-background-violet-650" style="color: #03dfff"
90+
><span><i class="fab fa-discord"></i></span> Join our Discord</a
91+
>
92+
<a href="https://www.linkedin.com/groups/14336241/" role="button" class="pico-background-azure-650" style="color: #03dfff"
93+
><span><i class="fab fa-linkedin"></i></span> Join our LinkedIn Group</a
94+
>
95+
</div>
96+
</article>
97+
</div>
98+
<div id="support">
99+
<h2>Support Black Python Devs</h2>
100+
<article>
101+
<div class="grid">
102+
<div>
103+
<script>
104+
(function () {
105+
if (document.getElementById("commitchange-script")) return;
106+
var npo = 6464;
107+
var script = document.createElement("script");
108+
var first = document.getElementsByTagName("script")[0];
109+
script.setAttribute("data-npo-id", npo);
110+
script.id = "commitchange-script";
111+
script.src = "https://us.commitchange.com/js/donate-button.v2.js";
112+
113+
script.onload = function () {
114+
const observer = new MutationObserver(function (mutations) {
115+
const iframe = document.querySelector(".commitchange-iframe-embedded");
116+
if (iframe && !iframe.hasAttribute("title")) {
117+
iframe.setAttribute("title", "Donation form for Black Python Devs");
118+
observer.disconnect(); // Stop observing once we've set the title
119+
}
120+
});
121+
122+
observer.observe(document.body, { childList: true, subtree: true });
123+
};
124+
125+
first.parentNode.insertBefore(script, first);
126+
})();
127+
</script>
128+
<a data-amounts="25,50,100,250,500,1000,1500" class="commitchange-donate" data-designation="Black Python Devs" data-embedded=""></a>
129+
</div>
130+
<div>
131+
<img class="donation-photo" src="/assets/images/gnome_powered_bpd_stacked.png" alt="Black Python Devs logo with GNOME Foundation sponsorship" />
132+
</div>
133+
</div>
134+
</article>
135+
<div>
136+
<p>
137+
Black Python Devs is a Non-Profit, fiscally hosted under the GNOME Foundation. GNOME does take a percentage for operating costs for our account and administration but at least 90% of proceeds goes directly to Black Python Devs General Purpose
138+
Fund as detailed here.
139+
</p>
140+
</div>
141+
<section>
142+
<h3>Corporate Sponsors</h3>
143+
<div class="grid">
144+
<article class="sponsor">
145+
<img src="/assets/images/typefully_brand.png" alt="Typefully Logo" />
146+
</article>
147+
<article class="sponsor">
148+
<svg style="align-self: centerkk" xmlns="http://www.w3.org/2000/svg" width="298" height="64" fill="none" viewBox="0 0 298 64">
149+
<defs>
150+
<linearGradient id="a" x1=".850001" x2="62.62" y1="62.72" y2="1.81" gradientUnits="userSpaceOnUse">
151+
<stop stop-color="#FF9419" />
152+
<stop offset=".43" stop-color="#FF021D" />
153+
<stop offset=".99" stop-color="#E600FF" />
154+
</linearGradient>
155+
</defs>
156+
<path
157+
fill="#000"
158+
d="M86.4844 40.5858c0 .8464-.1792 1.5933-.5377 2.2505-.3585.6573-.8564 1.1651-1.5137 1.5236-.6572.3585-1.3941.5378-2.2406.5378H78v6.1044h5.0787c1.912 0 3.6248-.4282 5.1484-1.2846 1.5236-.8564 2.7186-2.0415 3.585-3.5452.8663-1.5037 1.3045-3.1966 1.3045-5.0886V21.0178h-6.6322v19.568Zm17.8556-1.8224h13.891v-5.6065H104.34v-6.3633h15.355v-5.7758H97.8766v29.9743h22.2464v-5.7757H104.34v-6.453Zm17.865-11.8005h8.882v24.0193h6.633V26.9629h8.842v-5.9451h-24.367v5.9551l.01-.01Zm47.022 9.0022c-.517-.2788-1.085-.4879-1.673-.6472.449-.1295.877-.2888 1.275-.488 1.096-.5676 1.962-1.3643 2.579-2.39.618-1.0257.936-2.2007.936-3.5351 0-1.5237-.418-2.8879-1.244-4.0929-.827-1.195-1.992-2.131-3.486-2.8082-1.494-.6672-3.206-1.0058-5.118-1.0058h-13.315v29.9743h13.574c2.011 0 3.804-.3485 5.387-1.0556 1.573-.707 2.798-1.6829 3.675-2.9476.866-1.2547 1.304-2.6887 1.304-4.302 0-1.4837-.338-2.8082-1.026-3.9833-.687-1.175-1.633-2.0812-2.858-2.7285l-.01.0099Zm-13.603-9.9184h5.886c.816 0 1.533.1494 2.161.4382.627.2888 1.115.707 1.464 1.2547.348.5378.527 1.1751.527 1.9021 0 .7269-.179 1.414-.527 1.9817-.349.5676-.837.9958-1.464 1.3045-.628.3087-1.345.4581-2.161.4581h-5.886v-7.3492.0099Zm10.138 18.134c-.378.5676-.916 1.0058-1.603 1.3145-.697.3087-1.484.4581-2.39.4581h-6.145v-7.6878h6.145c.886 0 1.673.1693 2.37.4979.687.3286 1.235.7867 1.613 1.3842.378.5975.578 1.2747.578 2.0414 0 .7668-.19 1.4241-.568 1.9917Zm29.596-5.3077c1.663-.7967 2.947-1.922 3.864-3.3659.916-1.444 1.374-3.117 1.374-5.0289 0-1.912-.448-3.5253-1.344-4.9592-.897-1.434-2.171-2.5394-3.814-3.3261-1.644-.7867-3.546-1.1751-5.717-1.1751h-13.124v29.9743h6.642V40.0779h4.322l6.084 10.9142h7.578l-6.851-11.7208c.339-.1195.677-.249.996-.3983h-.01Zm-2.151-6.1244c-.369.6274-.896 1.1154-1.583 1.444-.688.3386-1.494.5079-2.42.5079h-5.975v-8.2953h5.975c.926 0 1.732.1693 2.42.4979.687.3287 1.214.8166 1.583 1.434.368.6174.558 1.3544.558 2.1908 0 .8365-.19 1.5734-.558 2.2008v.0199Zm20.594-11.7308-10.706 29.9743h6.742l2.121-6.6122h11.114l2.27 6.6122h6.612L220.99 21.0178h-7.189Zm-.339 18.3431 3.445-10.5756.409-1.922.408 1.922 3.685 10.5756h-7.947Zm20.693 11.6312h6.851V21.0178h-6.851v29.9743Zm31.02-9.6993-12.896-20.275h-6.463v29.9743h6.055V30.7172l12.826 20.2749h6.533V21.0178h-6.055v20.275Zm31.528-3.3559c-.647-1.2448-1.564-2.2904-2.729-3.1369-1.165-.8464-2.509-1.4041-4.023-1.6929l-5.098-1.0456c-.797-.1892-1.434-.5178-1.902-.9958-.469-.478-.708-1.0755-.708-1.7825 0-.6473.17-1.205.518-1.683.339-.478.827-.8464 1.444-1.1153.618-.2689 1.335-.3983 2.151-.3983.817 0 1.554.1394 2.181.4182.627.2788 1.115.6672 1.464 1.1751s.528 1.0755.528 1.7228h6.642c-.04-1.7427-.528-3.2863-1.444-4.6207-.916-1.3443-2.201-2.3899-3.834-3.1468-1.633-.7568-3.505-1.1352-5.597-1.1352-2.091 0-3.943.3884-5.566 1.1751-1.623.7867-2.898 1.8721-3.804 3.2663-.906 1.3941-1.364 2.9775-1.364 4.76 0 1.444.288 2.7485.876 3.9036.587 1.1652 1.414 2.1311 2.479 2.8979 1.076.7668 2.311 1.3045 3.725 1.6033l5.397 1.1153c.886.2091 1.584.5975 2.101 1.1551.518.5577.767 1.2448.767 2.0813 0 .6672-.189 1.2747-.567 1.8025-.379.5277-.907.936-1.584 1.2248-.677.2888-1.474.4282-2.39.4282-.916 0-1.782-.1593-2.529-.478-.747-.3186-1.325-.7767-1.733-1.3742-.418-.5875-.617-1.2747-.617-2.0414h-6.642c.029 1.8721.527 3.5152 1.513 4.9492.976 1.424 2.32 2.5394 4.033 3.336 1.713.7967 3.675 1.195 5.886 1.195 2.21 0 4.202-.4083 5.915-1.2249 1.723-.8165 3.057-1.9418 4.023-3.3758.966-1.434 1.444-3.0572 1.444-4.8696 0-1.4838-.329-2.848-.976-4.1028l.02.01Z"
159+
/>
160+
<path fill="url(#a)" d="M20.34 3.66 3.66 20.34C1.32 22.68 0 25.86 0 29.18V59c0 2.76 2.24 5 5 5h29.82c3.32 0 6.49-1.32 8.84-3.66l16.68-16.68c2.34-2.34 3.66-5.52 3.66-8.84V5c0-2.76-2.24-5-5-5H29.18c-3.32 0-6.49 1.32-8.84 3.66Z" />
161+
<path fill="#000" d="M48 16H8v40h40V16Z" />
162+
<path fill="#fff" d="M30 47H13v4h17v-4Z" />
163+
</svg>
164+
</article>
165+
<article class="sponsor">
166+
<img src="/assets/images/gnome-foundation-blue.png" alt="GNOME Foundation Logo" style="height: 2rem" />
167+
</article>
168+
</div>
169+
</section>
170+
</div><div>
171+
<h2>Partnerships</h2>
172+
173+
<p>We're happy to share with you our proud sponsors who offer their products at discounted rates and a portion of proceeds go to support Black Python Devs!</p>
174+
175+
<div class="grid">
176+
</div>
177+
</div><article>
178+
<h3></h3>
179+
<form action="https://buttondown.email/api/emails/embed-subscribe/black-python-devs" method="post" target="popupwindow" onsubmit="window.open('https://buttondown.email/black-python-devs', 'popupwindow')">
180+
<fieldset role="group">
181+
<input type="email" name="email" id="bd-email" placeholder="Enter your email" />
182+
<input type="submit" value="Subscribe" />
183+
</fieldset>
184+
</form>
185+
<p>
186+
<a href="https://buttondown.email/refer/black-python-devs" target="_blank">Powered by Buttondown.</a>
187+
</p>
188+
<p>
189+
<a href="https://buttondown.email/black-python-devs/archive">Read the latest issue.</a>
190+
</p>
191+
</article></div>
78192
</main><footer role="contentinfo">
79193
<div class="wrapper">
80194
<div class="footer-grid">

0 commit comments

Comments
 (0)