Skip to content

Commit 24500ee

Browse files
Add _redirects for CloudFlare pages
1 parent cbe2490 commit 24500ee

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

web/resources/_redirects

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/wiki/ /
2+
/wiki/:slug /:slug

web/scripts/builder.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ def create_function(self, function_name):
215215

216216
return function
217217

218-
def create_article(self, article_name, article_parent_path='', custom_web_path=False):
218+
def create_article(self, article_name, article_parent_path='', custom_web_path=False, custom_web_title=False):
219219
article_real_path = os.path.join(DOCS_REPO_PATH, 'articles', article_parent_path, article_name, f"article.yaml")
220220
article = utils.load_and_validate_yaml(article_real_path, self.schema_article)
221221

@@ -226,7 +226,10 @@ def create_article(self, article_name, article_parent_path='', custom_web_path=F
226226

227227
article_template = self.input_env.get_template('article.html')
228228
article["html_content"] = markdown.markdown(article['content'])
229-
html_content = self.render_page(article['title'], article_template.render(article=article))
229+
html_content = self.render_page(
230+
custom_web_title or article['title'],
231+
article_template.render(article=article)
232+
)
230233
if custom_web_path:
231234
web_path = custom_web_path
232235
else:
@@ -431,7 +434,7 @@ def create_pages(self):
431434

432435
def create_item(item):
433436
if 'article' in item:
434-
self.create_article(item['article']['name'], item['article']['folder'], item['path_html'])
437+
self.create_article(item['article']['name'], item['article']['folder'], item['path_html'], item["name"])
435438
elif 'category' in item:
436439
self.create_category(item['path_html'], item['category'])
437440

0 commit comments

Comments
 (0)