Repository navigation
Expand file tree
/
Copy pathapp.py
More file actions
163 lines (127 loc) · 3.67 KB
/
Copy pathapp.py
File metadata and controls
163 lines (127 loc) · 3.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
import datetime
import json
import pathlib
import pluggy
from render_engine import Site, Page, Collection, Blog, RedirectPage
from render_engine_markdown import MarkdownPageParser
from render_engine_clean_urls import CleanURLsPlugin
from scripts.map import generate_map
navigation = [
{
"text": "News",
"url": "/blog/blog1.html",
"icon": "iconoir-journal-page",
},
{
"text": "About Us",
"url": "/about.html",
"icon": "iconoir-group",
},
{
"text": "Events",
"url": "/events.html",
"icon": "iconoir-calendar",
},
{
"text": "Donate",
"url": "/support.html",
"icon": "iconoir-donate",
},
]
markdown_extras = [
"footnotes",
"fenced-code-blocks",
"header-ids",
"tables",
]
hookimpl = pluggy.HookimplMarker("render_engine")
class GenerateMapPlugin:
@staticmethod
@hookimpl
def pre_build_site():
generate_map()
app = Site()
app.template_path = "_layouts"
app.static_paths.add("assets")
app.site_vars["SITE_TITLE"] = "Black Python Devs"
app.site_vars["locales"] = ["en"]
app.site_vars["navigation"] = navigation
app.site_vars["DATETIME_FORMAT"] = "%d %b %Y"
app.site_vars["year"] = str(datetime.date.today().year)
app.site_vars["SITE_AUTHORS"] = json.loads(
pathlib.Path("_data/authors.json").read_text()
)
app.plugin_manager.register_plugin(GenerateMapPlugin)
app.plugin_manager.register_plugin(CleanURLsPlugin)
@app.page
class Index(Page):
template = "index.html"
content_path = "index.html"
template_vars = {}
@app.page
class Students(RedirectPage):
slug = "students"
redirect_url = "/student-ambassador-program.html"
@app.page
class Community(RedirectPage):
slug = "community"
redirect_url = "/about.html#join-the-community"
@app.page
class Partnerships(RedirectPage):
slug = "partnerships"
redirect_url = "/support.html#partnerships"
@app.page
class Leadership(RedirectPage):
slug = "leadership"
redirect_url = "/bpd-events/black-python-devs-leadership-summit-2026-ohio.html"
@app.page
class LeadershipSummit(RedirectPage):
slug = "leadership-summit"
redirect_url = "/bpd-events/black-python-devs-leadership-summit-2026-ohio.html"
@app.page
class Pycon(RedirectPage):
slug = "pycon"
redirect_url = "/blog/black-python-devs-at-pycon-us-2026.html"
@app.page
class About(Page):
template = "about.html"
data = json.loads(pathlib.Path("_data/leadership.json").read_text())
@app.page
class Support(Page):
Parser = MarkdownPageParser
content_path = "support.md"
template = "support.html"
data = {
"foundational_supporters": json.loads(
pathlib.Path("_data/foundational_supporters.json").read_text()
),
"partnerships": json.loads(pathlib.Path("_data/partnerships.json").read_text()),
}
@app.page
class Events(Page):
template = "events.html"
data = json.loads(pathlib.Path("_data/sponsored_events.json").read_text())
@app.collection
class BPDEvents(Collection):
title = "BPD Events"
Parser = MarkdownPageParser
parser_extras = {"markdown_extras": markdown_extras}
content_path = "events"
template = "default.html"
routes = ["./bpd-events"]
@app.collection
class Pages(Collection):
Parser = MarkdownPageParser
parser_extras = {"markdown_extras": markdown_extras}
content_path = "pages"
template = "default.html"
@app.collection
class Blog(Blog):
Parser = MarkdownPageParser
parser_extras = {"markdown_extras": markdown_extras}
template = "post.html"
content_path = "_posts"
routes = ["./blog"]
has_archive = True
archive_template = "blog-list.html"
items_per_page = 10