Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

docs: Update base titles for documentation pages.

Lauryn Menardf0dac7beef77
diff --git a/zerver/tests/test_docs.py b/zerver/tests/test_docs.py
index e0e8abdca40..fb44841154a 100644
--- a/zerver/tests/test_docs.py
+++ b/zerver/tests/test_docs.py
@@ -11,7 +11,7 @@ from django.utils.timezone import now as timezone_now
from corporate.models import Customer, CustomerPlan
from zerver.context_processors import get_apps_page_url
-from zerver.lib.integrations import INTEGRATIONS
+from zerver.lib.integrations import CATEGORIES, INTEGRATIONS, META_CATEGORY
from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.test_helpers import HostRequestMock
from zerver.models import Realm, get_realm
@@ -235,25 +235,33 @@ class DocPageTest(ZulipTestCase):
self.assertEqual(result.status_code, 404)
def test_integration_pages_open_graph_metadata(self) -> None:
+ og_description = '<meta property="og:description" content="Zulip comes with over'
+
+ # Test a particular integration page
url = "/integrations/doc/github"
- title = '<meta property="og:title" content="Connect GitHub to Zulip" />'
+ title = '<meta property="og:title" content="GitHub | Zulip integrations" />'
description = '<meta property="og:description" content="Zulip comes with over'
self._test(url, title, doc_html_str=True)
self._test(url, description, doc_html_str=True)
# Test category pages
- url = "/integrations/communication"
- title = '<meta property="og:title" content="Connect your Communication tools to Zulip" />'
- description = '<meta property="og:description" content="Zulip comes with over'
- self._test(url, title, doc_html_str=True)
- self._test(url, description, doc_html_str=True)
-
- # Test integrations page
+ for category in CATEGORIES.keys():
+ url = f"/integrations/{category}"
+ if category in META_CATEGORY.keys():
+ title = f"<title>{CATEGORIES[category]} | Zulip integrations</title>"
+ og_title = f'<meta property="og:title" content="{CATEGORIES[category]} | Zulip integrations" />'
+ else:
+ title = f"<title>{CATEGORIES[category]} tools | Zulip integrations</title>"
+ og_title = f'<meta property="og:title" content="{CATEGORIES[category]} tools | Zulip integrations" />'
+ self._test(url, title)
+ self._test(url, og_title, doc_html_str=True)
+ self._test(url, og_description, doc_html_str=True)
+
+ # Test integrations index page
url = "/integrations/"
- title = '<meta property="og:title" content="Connect the tools you use to Zulip" />'
- description = '<meta property="og:description" content="Zulip comes with over'
- self._test(url, title, doc_html_str=True)
- self._test(url, description, doc_html_str=True)
+ og_title = '<meta property="og:title" content="Zulip integrations" />'
+ self._test(url, og_title, doc_html_str=True)
+ self._test(url, og_description, doc_html_str=True)
def test_doc_html_str_non_ajax_call(self) -> None:
# We don't need to test all the pages for 404
diff --git a/zerver/tests/test_middleware.py b/zerver/tests/test_middleware.py
index d8ed3befbfc..93e3a56cd9e 100644
--- a/zerver/tests/test_middleware.py
+++ b/zerver/tests/test_middleware.py
@@ -94,7 +94,7 @@ class OpenGraphTest(ZulipTestCase):
# in the first paragraph.
self.check_title_and_description(
"/help/disable-message-edit-history",
- "Disable message edit history (Zulip Help Center)",
+ "Disable message edit history | Zulip help center",
[
"In Zulip, users can view the edit history of a message. | To remove the",
"best to delete the message entirely. ",
@@ -111,7 +111,7 @@ class OpenGraphTest(ZulipTestCase):
# deactivate-your-account starts with {settings_tab|account-and-privacy}
self.check_title_and_description(
"/help/deactivate-your-account",
- "Deactivate your account (Zulip Help Center)",
+ "Deactivate your account | Zulip help center",
["Any bots that you maintain will be disabled. | Deactivating "],
["Confirm by clicking", " ", "\n"],
)
@@ -120,7 +120,7 @@ class OpenGraphTest(ZulipTestCase):
# logging-out starts with {start_tabs}
self.check_title_and_description(
"/help/logging-out",
- "Logging out (Zulip Help Center)",
+ "Logging out | Zulip help center",
# Ideally we'd do something better here
[
"We're here to help! Email us at [email protected] with questions, feedback, or "
@@ -132,7 +132,7 @@ class OpenGraphTest(ZulipTestCase):
def test_index_pages(self) -> None:
self.check_title_and_description(
"/help/",
- "Zulip Help Center",
+ "Zulip help center",
[("Welcome to the Zulip")],
[],
)
@@ -153,7 +153,7 @@ class OpenGraphTest(ZulipTestCase):
self.check_title_and_description(
"/help/not-a-real-page",
# Probably we should make this "Zulip Help Center"
- "No such article. (Zulip Help Center)",
+ "No such article. | Zulip help center",
[
"No such article. | We're here to help!",
"Email us at [email protected] with questions, feedback, or feature requests.",
diff --git a/zerver/views/documentation.py b/zerver/views/documentation.py
index 96045a90871..6c4641a000d 100644
--- a/zerver/views/documentation.py
+++ b/zerver/views/documentation.py
@@ -12,7 +12,13 @@ from django.views.generic import TemplateView
from zerver.context_processors import zulip_default_context
from zerver.decorator import add_google_analytics_context
-from zerver.lib.integrations import CATEGORIES, INTEGRATIONS, HubotIntegration, WebhookIntegration
+from zerver.lib.integrations import (
+ CATEGORIES,
+ INTEGRATIONS,
+ META_CATEGORY,
+ HubotIntegration,
+ WebhookIntegration,
+)
from zerver.lib.request import REQ, RequestNotes, has_request_variables
from zerver.lib.subdomains import get_subdomain
from zerver.lib.templates import render_markdown_path
@@ -164,7 +170,7 @@ class MarkdownDirectoryView(ApiURLView):
context["doc_root_title"] = "Help center"
sidebar_article = self.get_path("include/sidebar_index")
sidebar_index = sidebar_article.article_path
- title_base = "Zulip Help Center"
+ title_base = "Zulip help center"
elif self.path_template == f"{settings.POLICIES_DIRECTORY}/%s.md":
context["page_is_policy_center"] = True
context["doc_root"] = "/policies/"
@@ -205,7 +211,7 @@ class MarkdownDirectoryView(ApiURLView):
article_title = first_line.lstrip("#").strip()
endpoint_name = endpoint_method = None
if context["not_index_page"]:
- context["PAGE_TITLE"] = f"{article_title} ({title_base})"
+ context["PAGE_TITLE"] = f"{article_title} | {title_base}"
else:
context["PAGE_TITLE"] = title_base
request_notes = RequestNotes.get_notes(self.request)
@@ -264,16 +270,19 @@ def add_integrations_open_graph_context(context: Dict[str, Any], request: HttpRe
if path_name in INTEGRATIONS:
integration = INTEGRATIONS[path_name]
- context["PAGE_TITLE"] = f"Connect {integration.display_name} to Zulip"
+ context["PAGE_TITLE"] = f"{integration.display_name} | Zulip integrations"
context["PAGE_DESCRIPTION"] = description
elif path_name in CATEGORIES:
category = CATEGORIES[path_name]
- context["PAGE_TITLE"] = f"Connect your {category} tools to Zulip"
+ if path_name in META_CATEGORY:
+ context["PAGE_TITLE"] = f"{category} | Zulip integrations"
+ else:
+ context["PAGE_TITLE"] = f"{category} tools | Zulip integrations"
context["PAGE_DESCRIPTION"] = description
elif path_name == "integrations":
- context["PAGE_TITLE"] = "Connect the tools you use to Zulip"
+ context["PAGE_TITLE"] = "Zulip integrations"
context["PAGE_DESCRIPTION"] = description