-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpelicanconf.py
More file actions
151 lines (124 loc) · 3.51 KB
/
pelicanconf.py
File metadata and controls
151 lines (124 loc) · 3.51 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
#!/usr/bin/env python3
import functools
AUTHOR = "Giampaolo Rodola"
SITENAME = "Giampaolo Rodola"
SITESUBTITLE = "Python enthusiast, core developer, psutil author"
SITEURL = "http://127.0.0.1:8000"
THEME = "theme"
PATH = "content"
TIMEZONE = "Europe/Rome"
DEFAULT_LANG = "en"
# Force English date formatting regardless of build host locale.
LOCALE = ("en_US.UTF-8", "en_US.utf8", "en_US", "C.UTF-8")
# GA4 measurement ID (format: "G-XXXXXXXXXX"). Leave empty to disable.
# Old UA-164357405-2 was Universal Analytics; sunset by Google in 2023.
GOOGLE_ANALYTICS = ""
# --- atom feeds (http://127.0.0.1:8000/feeds)
# Planet python uses:
# https://gmpy.dev/feeds/atom.tag.python.xml
FEED_ALL_ATOM = "feeds/atom.all.xml"
TAG_FEED_ATOM = "feeds/atom.tag.{slug}.xml"
AUTHOR_FEED_ATOM = None
AUTHOR_FEED_RSS = None
CATEGORY_FEED_ATOM = None
CATEGORY_FEED_RSS = None
TRANSLATION_FEED_ATOM = None
TRANSLATION_FEED_RSS = None
# --- social widget
SOCIAL = (
("GitHub", "https://github.com/giampaolo"),
("LinkedIn", "https://www.linkedin.com/in/grodola/"),
("X", "https://x.com/grodola"),
)
# --- menu
MENUITEMS = (
("Blog", "/"),
("Archives", "/archives"),
("Donate", "https://psutil.readthedocs.io/latest/funding.html"),
("About", "/about"),
)
# --- blog
ARTICLE_PATHS = ["blog"]
ARTICLE_URL = "blog/{date:%Y}/{slug}"
ARTICLE_SAVE_AS = "blog/{date:%Y}/{slug}.html"
DEFAULT_PAGINATION = 5
# --- pages
PAGE_PATHS = [""]
PAGE_URL = "{slug}"
PAGE_SAVE_AS = "{slug}.html"
# Categories are not used; disable per-category pages and the index.
# Also stop auto-assigning a category from the folder name.
USE_FOLDER_AS_CATEGORY = False
CATEGORY_SAVE_AS = ""
CATEGORIES_SAVE_AS = ""
# Do not generate /author/* HTML files.
AUTHOR_SAVE_AS = ""
# --- tags
TAG_SAVE_AS = "tags/{slug}.html"
TAG_URL = "tags/{slug}"
# --- plugins
PLUGIN_PATHS = ["plugins"]
# headerid is for RST; Markdown posts use the `toc` extension below.
PLUGINS = ["headerid"]
MARKDOWN = {
"extensions": [
"markdown.extensions.codehilite",
"markdown.extensions.extra",
"markdown.extensions.meta",
"markdown.extensions.toc",
],
"extension_configs": {
"markdown.extensions.codehilite": {"css_class": "highlight"},
"markdown.extensions.extra": {},
"markdown.extensions.meta": {},
"markdown.extensions.toc": {
"permalink": "¶", # matches headerid.py output for RST
"permalink_class": "headerlink",
"permalink_title": "Permalink to this headline",
},
},
"output_format": "html5",
}
# ---paths
# static paths will be copied without parsing their contents
STATIC_PATHS = [
"static",
"images",
"extra",
]
EXTRA_PATH_METADATA = {
"extra/favicon.ico": {"path": "favicon.ico"},
"extra/htaccess": {"path": ".htaccess"},
"extra/CNAME": {"path": "CNAME"},
"extra/robots.txt": {"path": "robots.txt"},
}
DIRECT_TEMPLATES = ["index", "tags", "categories", "archives", "sitemap"]
TEMPLATE_EXTENSIONS = [".html", ".xml"]
SITEMAP_SAVE_AS = "sitemap.xml"
# --- others
def month_abbr(dt):
months = [
"",
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec",
]
return months[dt.month]
JINJA_FILTERS = {
"sort_by_tags": functools.partial(
sorted,
key=lambda tags: (len(tags[1]), -ord(tags[0].name[0])),
reverse=True,
),
"month_abbr": month_abbr,
}
DEFAULT_DATE_FORMAT = "%d %b %Y"