-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpelicanconf.py
299 lines (261 loc) · 8.62 KB
/
pelicanconf.py
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
import inspect
import urllib.parse
import os
import sys
from functools import partial
sys.path.append(os.curdir)
import projects
import friends
import comments
AUTHOR = 'Kaffa'
AUTHOR_NAME = 'Kaffa'
SITENAME = '<span class="is-italic author_name">Kaffa</span>.im'
SITESUBTITLE = '' # 'Kunnect Adventures & Fun'
MANTRA = '<span class="has-text-grey is-size-6"><span class="is-italic author_name">K</span>unnect</span>'\
'<sup class="has-text-grey is-size-7">'\
' <span class="is-italic author_name">a</span>dventures & <span class="is-italic author_name">f</span>un'\
'</sup>'
AUTHOR_INTRO = '探索人生,分享意趣。'
SITEURL = 'https://kaffa.im'
TIMEZONE = 'Asia/Shanghai'
GITHUB_URL = 'http://github.com/kaffa/'
PATH = 'content'
OUTPUT_PATH = 'docs/'
DEFAULT_DATE_FORMAT = '%Y-%m-%d %a'
DEFAULT_LANG = 'zh-CN'
# Feed generation is usually not desired when developing
FEED_ALL_RSS = 'feed.xml'
FEED_ALL_ATOM = 'feeds/all.atom.xml'
CATEGORY_FEED_ATOM = None
TRANSLATION_FEED_ATOM = None
AUTHOR_FEED_ATOM = None
AUTHOR_FEED_RSS = None
RSS_FEED_SUMMARY_ONLY = True
# Blogroll
LINKS = [
{'group': '数字花园', 'items': (
('仿生猫不会梦见电子猫粮', 'https://jefftay.com/'),
('MemEX', 'https://note.justgoidea.com/'),
('蓝星梦寻', 'https://coffee.kaffa.im/'),)},
{'group': '园艺先驱', 'items': (
('EastGate Garden', 'https://www.eastgate.com/garden/Enter.html'),
('Evergreen Notes', 'http://andymatuschak.org'),
('Maggie Appleton', 'https://maggieappleton.com/'),)},
{'group': '收录', 'items': (
('十年之约', 'https://www.foreverblog.cn'),
('BlogFinder', 'https://bf.zzxworld.com'),
('个站商店', 'https://storeweb.cn/'),
('博客志', 'http://www.jetli.com.cn'),
('积薪', 'https://firewood.news'),
('博客圈', 'https://bkq.net.cn/'),
('博友圈', 'https://www.boyouquan.com/home'),)},
{'group': '链接', 'items': (
('Guido van Rossum', 'https://gvanrossum.github.io/'),
('danluu.com', 'https://danluu.com/'),
('Hacker News', 'https://news.ycombinator.com/'),
('论道', 'https://lundao.pub/'),)},
]
CATEGORY_LINKS = {
'project': [],
'development': [],
'programming': [],
'website': [],
'reading': [],
'digital': [],
'words': [],
'article': [],
'software': [],
'book-list': [],
'weekly': [],
'book': [],
'movie': [
{'group': '影片库', 'items': (
('IMDB', 'https://www.imdb.com/'),)},
{'group': '评论', 'items': (
('豆瓣', 'https://www.douban.com/'),)},
],
'music': [],
'things': [],
}
# Social widget
SOCIAL = (('My GitHub', 'https://github.com/kaffa'),)
DEFAULT_PAGINATION = 12
# Uncomment following line if you want document-relative URLs when developing
RELATIVE_URLS = True
# 20190518 添加
DISPLAY_CATEGORIES_ON_MENU = False
# 20230913 添加
# 20231019 修改
DISPLAY_PAGES_ON_MENU = False
# THEME = "D:/code/github/kaffa/kaffa.github.io/theme/pelican-octopress-theme-cn"
THEME = "D:/code/github/kaffa/kaffa.github.io/theme/pelican-kaffa-theme"
THEME_STATIC_DIR = 'static'
STATIC_PATHS = ['static']
EXTRA_PATH_METADATA = {
'static/favicon/favicon.ico': {'path': 'favicon.ico'},
'static/CNAME': {'path': 'CNAME'},
'static/robots.txt': {'path': 'robots.txt'},
'static/tencent18389128716212478341.txt': {'path': 'tencent18389128716212478341.txt'},
}
PLUGIN_PATHS = ['plugins']
PLUGINS = [
'sitemap',
'plantuml',
'featured_image',
'kaffapod',
'followclaim'
# 'statics',
# 'minify'
# 'gravatar',
# 'ace_editor'
]
# plugin: sitemap
SITEMAP = {
'format': 'xml',
'priorities': {
'articles': 0.5,
'indexes': 0.5,
'pages': 0.5
},
'changefreqs': {
'articles': 'monthly',
'indexes': 'daily',
'pages': 'monthly'
},
'exclude': [
'tag/',
'category/'
]
}
# plugin: kaffapod
KAFFAPOD = {
# SQLite 数据库相对 PATH 目录的路径
'db_path': r'\db\0.db',
# img 本地目录
'img_folder': os.path.join(os.path.dirname(inspect.getfile(inspect.currentframe())), PATH, THEME_STATIC_DIR, 'img'),
# img 相对目录,用于 web 拼接
'img_relative_folder': '/static/img/'
}
JINJA_FILTERS = {
'sort_by_article_count': partial(sorted, key=lambda tag: len(tag[1]), reverse=True)
}
# plugin: plantuml
PLANTUML = {
'java_path': r'D:\Java\jdk-19\bin\java.exe',
'plantuml_jar_path': r'D:\soft\plantuml-jar-gplv2-1.2023.7\plantuml.jar',
'uml_image_folder': '/static/img/'
}
# plugin: ace_editor
ACE_EDITOR_PLUGIN = {
'ACE_EDITOR_THEME': 'chrome',
'ACE_EDITOR_SCROLL_TOP_MARGIN': 0,
'ACE_EDITOR_MAXLINES': 50,
'ACE_EDITOR_READONLY': True,
'ACE_EDITOR_AUTOSCROLL': True,
'ACE_EDITOR_SHOW_INVISIBLE': True
}
MARKDOWN = {
'extension_configs': {
'markdown.extensions.codehilite': {
'css_class': 'highlight',
'linenums': False,
'use_pygments': True
},
'markdown.extensions.extra': {},
'markdown.extensions.meta': {},
},
'output_format': 'html5',
}
# plugin: minify
CSS_MIN = True
HTML_MIN = True
INLINE_CSS_MIN = True
INLINE_JS_MIN = True
COLORFUL_SITENAME = '''<
span style="color:#52A2C6">褪</span><
span style="color:#6791BC">色</span><
span style="color:#7C80B2">的</span><
span style="color:#916FA8">抽</span><
span style="color:#A65E9E">象</span>'''
# My Data
AVATAR_URL = 'https://kaffa.im/static/img/kaffa-avatar.png' #'https://avatars.githubusercontent.com/u/4386281?v=4'
# mailto
mailto_email = urllib.parse.quote('[email protected]')
mailto_subject = urllib.parse.quote('网站反馈')
mailto_body = urllib.parse.quote('提示:可反馈“在什么场景下,做什么操作时,遇到什么问题。”')
mailto = f'mailto:{mailto_email}?subject={mailto_subject}&body={mailto_body}'
# menu
MENUITEMS = (
("专栏", "/", (
("项目", "/category/project.html"),
("-", ""),
("研发", "/category/development.html"),
("编程", "/category/programming.html"),
)),
("笔记", "/", (
("网站", "/category/website.html"),
("-", ""),
("阅读", "/category/reading.html"),
("-", ""),
("数智", "/category/digital.html"),
("-", ""),
("言论", "/category/words.html")
)),
("创作", "/", (
("文章", "/category/article.html"),
("-", ""),
("软件", "/category/software.html"),
("-", ""),
("书单", "/category/book-list.html"),
("-", ""),
("周报", "/category/weekly.html"),
)),
("我的", "/", (
("书", "/category/book.html"),
("影", "/category/movie.html"),
("音", "/category/music.html"),
# ("-", ""),
# ("店", "/category/shop/"),
# ("食", "/category/food/"),
("-", ""),
("物", "/category/things.html"),
)),
("关于", "/", (
("站长", "/pages/about.html"),
("网站", "/pages/about-website.html"),
("联系我", "/pages/contact.html"),
("-", ""),
("网站反馈", mailto),
)),
)
CATEGORY_DICT = {
'project': {'name': '项目', 'moment': '启动一个项目'},
'development': {'name': '研发', 'moment': '记录一篇随笔'},
'programming': {'name': '编程', 'moment': '记录一篇随笔'},
'website': {'name': '网站', 'moment': '记录一条笔记'},
'reading': {'name': '读书', 'moment': '记录一条笔记'},
'digital': {'name': '数智', 'moment': '记录一条笔记'},
'words': {'name': '言论', 'moment': '记录一条言论'},
'article': {'name': '文章', 'moment': '创作一篇文章'},
'software': {'name': '软件', 'moment': '记录一个软件'},
'book-list': {'name': '书单', 'moment': '精选一款书单'},
'weekly': {'name': '周报', 'moment': '汇报一次周报'},
'book': {'name': '书', 'moment': '阅读一本书籍'},
'movie': {'name': '影', 'moment': '观赏一部电影'},
'music': {'name': '音', 'moment': '收藏一首音乐'},
'things': {'name': '物', 'moment': '标记一个物品'},
}
GROWTH_DICT = {
'1': {'img': 'seedling.svg', 'title': '幼苗'},
'3': {'img': 'budding.svg', 'title': '发育中...'},
'5': {'img': 'evergreen.svg', 'title': '常青树'},
}
JAVASCRIPT_HEAD = ''
JAVASCRIPT_FOOT = ''
PROJECTS = projects.get_list()
FRIENDS = friends.get_list()
COMMENT_NODES = comments.get_list()
COMMENT_ALL_URL = 'https://github.com/kaffa/kaffa.im/discussions'