Skip to content

Commit af76b6c

Browse files
authored
Add pagination to blog (#743)
* add pagination * update blog starting point
1 parent 66d0068 commit af76b6c

File tree

5 files changed

+19
-8
lines changed

5 files changed

+19
-8
lines changed

_layouts/_includes/header.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<h1 class="site-title">
44
<a class="logo-text" href="/index.html"><img src="{{ '/assets/images/black_python_devs_logo-horizontal-white.png' }}" alt="Black Python Devs" /></a>
55
</h1>
6-
<nav class="site-navigation" aria-label="Main navigation">
6+
<nav class="site-navigation" aria-label="Main navigation" style="padding-right: 2em">
77
<div class="site-navigation-wrap">
88
<ul class="menu" role="menu">
99
{% for item in navigation %} {% set current = nil %} {% set nav_lang = nil %} {% if url == item.url %} {% set current = 'nav-current' %} {% endif %} {% if lang != 'en' %} {% set nav_lang = lang %} {% endif %}

_layouts/blog-list.html

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,14 @@ <h2><a href="{{ page }}.html">
1717
</article>
1818
{% endfor %}
1919
</section>
20-
{% endblock %}
20+
<section>
21+
<div role="group">
22+
<h4>Pages:</h4>
23+
<div>
24+
{% for page in range(1, num_of_pages + 1) %}
25+
<a role="button" {% if page == archive_index %} disabled {% endif %} href="/blog/blog{{page}}.html">{{ page }}</a>
26+
{% endfor %}
27+
</div>
28+
</div>
29+
</section>
30+
{%endblock %}

app.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
navigation = [
1111
{"text": "Home", "url": "/index.html", "fa": "fa fa-home fa-fw"},
12-
{"text": "Blog", "url": "/blog", "fa": "fa fa-newspaper fa-fw"},
12+
{"text": "Blog", "url": "/blog/blog1.html", "fa": "fa fa-newspaper fa-fw"},
1313
{"text": "About Us", "url": "/about.html", "fa": "fa fa-info-circle fa-fw"},
1414
{"text": "BPD Events", "url": "/bpd-events", "fa": "fa fa-calendar fa-fw"},
1515
{
@@ -87,3 +87,4 @@ class Blog(Blog):
8787
routes = ["./blog"]
8888
has_archive = True
8989
archive_template = "blog-list.html"
90+
items_per_page = 10

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "blackpythondevs-site"
33
version = "0.1.0"
44
description = "Black Python Devs community website"
5-
dependencies = ["render-engine[cli]==2025.6.1b2", "pyyaml"]
5+
dependencies = ["render-engine[cli]>=2025.7.1a1", "pyyaml"]
66

77
[project.optional-dependencies]
88
dev = [

uv.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)