forked from BlackPythonDevs/blackpythondevs.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
108 lines (90 loc) · 2.45 KB
/
Copy pathapp.py
File metadata and controls
108 lines (90 loc) · 2.45 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
import datetime
import json
import pathlib
from render_engine import Site, Page, Collection, Blog
from render_engine_markdown import MarkdownPageParser
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": "Support Us",
"url": "/support.html",
"icon": "iconoir-donate",
},
]
markdown_extras = [
"footnotes",
"fenced-code-blocks",
"header-ids",
"tables",
]
app = Site()
app.template_path = "_layouts"
app.static_paths.add("assets")
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.page
class Index(Page):
template = "index.html"
content_path = "index.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