documentation: Remove "not_index_page" from context.

In commit bbecd41, we added "not_index_page" to the context for
some documentation articles, but use of that context key/value was
removed when the help documentation was removed in commit 1cf7ee9.

Changes `not_index_page` to be a boolean value that's used to set
the page title, but is not then passed on as a context key/value.

Also removes an irrelevant comment about disabling "Back to home"
on the homepage.
This commit is contained in:
Lauryn Menard 2023-01-18 19:13:33 +01:00 committed by Tim Abbott
parent 37431cf0b5
commit f7d5cd5690

View File

@ -148,6 +148,8 @@ class MarkdownDirectoryView(ApiURLView):
documentation_article = self.get_path(article)
context["article"] = documentation_article.article_path
not_index_page = not context["article"].endswith("/index.md")
if documentation_article.article_path.startswith("/") and os.path.exists(
documentation_article.article_path
):
@ -163,8 +165,6 @@ class MarkdownDirectoryView(ApiURLView):
settings.DEPLOY_ROOT, "templates", documentation_article.article_path
)
# For disabling the "Back to home" on the homepage
context["not_index_page"] = not context["article"].endswith("/index.md")
if self.path_template == "/zerver/help/%s.md":
context["page_is_help_center"] = True
context["doc_root"] = "/help/"
@ -211,7 +211,7 @@ class MarkdownDirectoryView(ApiURLView):
else:
article_title = first_line.lstrip("#").strip()
endpoint_name = endpoint_method = None
if context["not_index_page"]:
if not_index_page:
context["PAGE_TITLE"] = f"{article_title} | {title_base}"
else:
context["PAGE_TITLE"] = title_base