-
Notifications
You must be signed in to change notification settings - Fork 4
/
conf.py
221 lines (168 loc) · 6.36 KB
/
conf.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
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import time
import jinja_filters
# Data about this site
BLOG_AUTHOR = "Guillaume Paumier" # (translatable)
BLOG_TITLE = "Guillaume Paumier" # (translatable)
SITE_URL = "https://www.guillaumepaumier.com/"
# BASE_URL = "https://guillaumepaumier.com/"
BLOG_EMAIL = "[email protected]"
BLOG_DESCRIPTION = {"en": "defying the Second Law of Thermodynamics since 1982", "fr": "défiant la deuxième loi de la thermodynamique depuis 1982"}
DEPLOY_DRAFTS = False
DEFAULT_LANG = "en"
TRANSLATIONS = {
DEFAULT_LANG: "",
"fr": "./fr",
}
TRANSLATIONS_PATTERN = "{path}_{lang}.{ext}"
NAVIGATION_LINKS = {
DEFAULT_LANG: (
("/archive.html", "Archive"),
("/categories/", "Tags"),
("/rss.xml", "RSS feed"),
),
"fr": (
("/fr/archive.html", "Archives"),
("/fr/categories/", "Étiquettes"),
("/fr/rss.xml", "Flux RSS"),
),
}
THEME = "phenix"
POSTS = (
("src/articles/*.rst", "articles", "post.j2"),
#("src/projects/*.rst", {"en": "projects", "fr": "projets"}, "project.tmpl"),
# ("src/projects/*_fr.rst", "projects", "post.tmpl"),
# ("src/photos/*.rst", "photos", "post.tmpl"),
# ("src/events/*.rst", "events", "post.tmpl"),
)
PAGES = (
("src/pages/*.rst", "", "page.j2"),
("src/pages/wikimedia/*.rst", "wikimedia", "project.j2"),
("src/pages/play/*.rst", {"en": "play", "fr": "loisirs"}, "project.j2"),
("src/pages/scitech/*.rst", "scitech", "project.j2")
)
TIMEZONE = "America/Los_Angeles"
# If you want to use ISO 8601 (also valid RFC 3339) throughout Nikola
# (especially in new_post), set this to True.
# Note that this does not affect DATE_FORMAT.
# FORCE_ISO8601 = False
# Date format used to display post dates. (translatable)
# (str used by datetime.datetime.strftime)
# DATE_FORMAT = '%Y-%m-%d %H:%M'
# Date format used to display post dates, if local dates are used. (translatable)
# (str used by moment.js)
# JS_DATE_FORMAT = 'YYYY-MM-DD HH:mm'
# Date fanciness.
#
# 0 = using DATE_FORMAT and TIMEZONE
# 1 = using JS_DATE_FORMAT and local user time (via moment.js)
# 2 = using a string like “2 days ago”
#
# Your theme must support it, bootstrap and bootstrap3 already do.
# DATE_FANCINESS = 0
FILES_FOLDERS = {'src/files': ''}
LISTINGS_FOLDERS = {'src/listings': 'listings'}
COMPILERS = {
"rest": ('.rst', '.txt'),
"ipynb": ('.ipynb',),
}
SHOW_UNTRANSLATED_POSTS = False
WRITE_TAG_CLOUD = False
POSTS_SECTIONS = False
# Paths for different autogenerated bits. These are combined with the
# translation paths.
# Final locations are:
# output / TRANSLATION[lang] / TAG_PATH / index.html (list of tags)
# output / TRANSLATION[lang] / TAG_PATH / tag.html (list of posts for a tag)
# output / TRANSLATION[lang] / TAG_PATH / tag.xml (RSS feed for a tag)
# (translatable)
TAG_PATH = {
DEFAULT_LANG: "topic",
"fr": "sujet"
}
TAGS_INDEX_PATH = ""
# Final location for the main blog page and sibling paginated pages is
# output / TRANSLATION[lang] / INDEX_PATH / index-*.html
INDEX_PATH = "list"
ARCHIVE_PATH = ""
from nikola import filters
from nikola.filters import apply_to_text_file
from custom_filters.rewrite_images import rewrite_images
FILTERS = {
".html": [
filters.typogrify,
rewrite_images,
],
# ".js": [filters.closure_compiler],
# ".jpg": ["jpegoptim --strip-all -m75 -v %s"],
}
# #############################################################################
# Image Gallery Options
# #############################################################################
# One or more folders containing galleries. The format is a dictionary of
# {"source": "relative_destination"}, where galleries are looked for in
# "source/" and the results will be located in
# "OUTPUT_PATH/relative_destination/gallery_name"
# Default is:
# GALLERY_FOLDERS = {"galleries": "galleries"}
# More gallery options:
# THUMBNAIL_SIZE = 180
MAX_IMAGE_SIZE = 10000
# USE_FILENAME_AS_TITLE = True
# EXTRA_IMAGE_EXTENSIONS = []
#
# If set to False, it will sort by filename instead. Defaults to True
# GALLERY_SORT_BY_DATE = True
#
# Folders containing images to be used in normal posts or pages. Images will be
# scaled down according to IMAGE_THUMBNAIL_SIZE and MAX_IMAGE_SIZE options, but
# will have to be referenced manually to be visible on the site
# (the thumbnail has ``.thumbnail`` added before the file extension).
# The format is a dictionary of {source: relative destination}.
IMAGE_FOLDERS = {
'src/images/others': 'images',
'src/images/others-free': 'images',
'src/images/own': 'images',
#'src/test-images': 'images',
}
# IMAGE_THUMBNAIL_SIZE = 400
IMAGE_SRCSET_SIZES = [400, 800, 1200, 1600, 2400, 3200, 4000]
IMAGE_SRCSET_FORMAT = '{name}.{size}{ext}'
EXTRA_IMAGE_EXTENSIONS = ['.webp']
PRESERVE_EXIF_DATA = True
EXIF_WHITELIST = {'*': '*'}
STRIP_INDEXES = True
PRETTY_URLS = True
COPY_SOURCES = False
# By default, Nikola generates RSS files for the website and for tags, and
# links to it. Set this to False to disable everything RSS-related.
# GENERATE_RSS = True
# By default, Nikola does not generates Atom files for indexes and links to
# them. Generate Atom for tags by setting TAG_PAGES_ARE_INDEXES to True.
# Atom feeds are built based on INDEX_DISPLAY_POST_COUNT and not FEED_LENGTH
# Switch between plain-text summaries and full HTML content using the
# FEED_TEASER option. FEED_LINKS_APPEND_QUERY is also respected. Atom feeds
# are generated even for old indexes and have pagination link relations
# between each other. Old Atom feeds with no changes are marked as archived.
# GENERATE_ATOM = False
FEED_TEASERS = False
# Disable the build-in image scaling plugin since we're adapting it in a custom copy:
DISABLED_PLUGINS = ["scale_images"]
# Templates will use those filters, along with the defaults.
# Consult your engine's documentation on filters if you need help defining
# those.
TEMPLATE_FILTERS = {
'get_lead_text': jinja_filters.get_lead_text,
'get_lead_figure': jinja_filters.get_lead_figure,
'remove_lead_figure': jinja_filters.remove_lead_figure
}
# Put in global_context things you want available on all your templates.
# It can be anything, data, functions, modules, etc.
GLOBAL_CONTEXT = {
'default_lang': DEFAULT_LANG,
}
# Add functions here and they will be called with template
# GLOBAL_CONTEXT as parameter when the template is about to be
# rendered
GLOBAL_CONTEXT_FILLER = []