-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathsettings.py
157 lines (128 loc) · 3.96 KB
/
settings.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
"""
# -*- coding: utf-8 -*- #
# Pelican configuration file
"""
# --- Imports ---
from datetime import date
import os
import csv
# --- Environmental Variables ---
PUBLISH = os.environ.get("PUBLISH")
print(f"PUBLISH: {PUBLISH}")
CURRENTYEAR = date.today().year
# --- Basic Settings ---
TIMEZONE = "UTC"
DEFAULT_LANG = "en"
AUTHOR = "CloudBytes"
SITENAME = "CloudBytes/dev>"
SITEURL = "https://cloudbytes.dev" if PUBLISH else "http://localhost:8080"
# Delete output directory before build
DELETE_OUTPUT_DIRECTORY = True
# --- Paths & Directories ---
THEME_STATIC_DIR = "assets"
THEME = "design/alexis"
PATH = "content" # Path to blog content
STATIC_PATHS = [
"images",
"extra/SW.js",
"extra/robots.txt",
"extra/ads.txt",
]
EXTRA_PATH_METADATA = {
"extra/SW.js": {"path": "SW.js"},
"extra/robots.txt": {"path": "robots.txt"},
"extra/ads.txt": {"path": "ads.txt"},
}
# --- URL & Save Patterns ---
ARTICLE_URL = "{category}/{slug}"
ARTICLE_SAVE_AS = "{category}/{slug}/index.html"
AUTHOR_URL = "authors/{slug}"
AUTHOR_SAVE_AS = "authors/{slug}/index.html"
CATEGORY_URL = "{slug}"
CATEGORY_SAVE_AS = "{slug}/index.html"
TAG_URL = "tags/{slug}"
TAG_SAVE_AS = "tags/{slug}/index.html"
PAGE_URL = "{slug}.html"
PAGE_SAVE_AS = "{slug}.html"
# --- Feed Settings ---
FEED_ALL_ATOM = "feeds/all.atom.xml"
CATEGORY_FEED_ATOM = "feeds/{slug}.atom.xml"
TRANSLATION_FEED_ATOM = None
AUTHOR_FEED_ATOM = None
AUTHOR_FEED_RSS = None
HOME_HIDE_TAGS = True
# --- Pagination Settings ---
DEFAULT_PAGINATION = 6
PAGINATION_PATTERNS = (
(1, "{url}", "{save_as}"),
(2, "{base_name}/{number}/", "{base_name}/{number}/index.html"),
)
PAGINATED_TEMPLATES = {"index": None, "tag": None, "category": None, "author": None}
# Uncomment following line if you want document-relative URLs when developing
# RELATIVE_URLS = True
# --- Markdown Extensions ---
MARKDOWN = {
"extension_configs": {
# Needed for code syntax highlighting
"markdown.extensions.codehilite": {
"css_class": "highlight",
},
"markdown.extensions.extra": {},
"markdown.extensions.meta": {},
"markdown.extensions.admonition": {},
# This is for enabling the TOC generation
"markdown.extensions.toc": {"title": "Table of Contents", "toc_depth": 3},
},
"output_format": "html5",
}
# --- Plugin Settings ---
# ---------------------------------------------
# --- Tag Cloud Settings ---
TAG_CLOUD_STEPS = 4
TAG_CLOUD_MAX_ITEMS = 100
TAG_CLOUD_SORTING = "size"
TAG_CLOUD_BADGE = True
# --- Sitemap Settings ---
SITEMAP = {
"format": "xml",
"priorities": {"articles": 1, "indexes": 1, "pages": 0.25},
"changefreqs": {"articles": "weekly", "indexes": "daily", "pages": "monthly"},
}
# --- Algolia Settings ---
ALGOLIA_APP_ID = "XE8PCLJHAE"
ALGOLIA_SEARCH_API_KEY = "ec75de1d8ce87dee234a2fd47cec2d76"
ALGOLIA_INDEX_NAME = "cloudbytes_dev"
ALGOLIA_ADMIN_API_KEY = os.environ.get("ALGOLIA_ADMIN_API_KEY")
# --- Related Posts Settings ---
RELATED_POSTS_MAX = 5
# ---------------------------------------------
# --- Google Analytics Settings ---
# Following items are often useful when publishing
GTAG = "G-9VKX48YDBH" if PUBLISH else None
# --- Active Plugins ---
# Plugin configuration
# ---------------------------------------------
common_plugins = [
"pelican.plugins.sitemap",
"pelican.plugins.tag_cloud",
"pelican.plugins.related_posts",
"pelican.plugins.series",
"plugins.fix_sitemap",
]
dev_plugins = common_plugins.copy()
prod_extra_plugins = [
"plugins.search",
"plugins.minify",
]
prod_plugins = common_plugins + prod_extra_plugins
PLUGINS = prod_plugins if PUBLISH else dev_plugins
# --- Udemy Affiliate Settings ---
# ---------------------------------------------
with open("resources/courses.csv") as csvfile:
reader = csv.DictReader(csvfile)
courses = list(reader)
COURSES = {course["tag"]: course for course in courses}
UDEMY = {
"aid": "zOWbNCBDzko", # Account ID
"pid": "1060092", # Product ID (Udemy)
}