Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
templates: Rename `OPEN_GRAPH` variables to `PAGE` or `PAGE_METADATA`.
Lauryn Menard049302fe6143
diff --git a/templates/corporate/attribution.html b/templates/corporate/attribution.htmlindex f162fd26800..ad92f8d68f9 100644--- a/templates/corporate/attribution.html+++ b/templates/corporate/attribution.html@@ -5,8 +5,8 @@<title>Zulip attributions</title>{% endblock %}-{% set OPEN_GRAPH_TITLE = 'Zulip website attributions' %}-{% set OPEN_GRAPH_DESCRIPTION = '' %}+{% set PAGE_TITLE = 'Zulip website attributions' %}+{% set PAGE_DESCRIPTION = '' %}{% block customhead %}<meta name="viewport" content="width=device-width, initial-scale=1.0" />diff --git a/templates/corporate/development-community.html b/templates/corporate/development-community.htmlindex 0bd59ab0b88..751d0a0017e 100644--- a/templates/corporate/development-community.html+++ b/templates/corporate/development-community.html@@ -1,8 +1,8 @@{% extends "zerver/portico.html" %}{% set entrypoint = "landing-page" %}-{% set OPEN_GRAPH_TITLE = 'The Zulip development community' %}-{% set OPEN_GRAPH_DESCRIPTION = 'Join the Zulip community to contribute, ask questions, or provide feedback to the creators of Zulip.' %}+{% set PAGE_TITLE = 'The Zulip development community' %}+{% set PAGE_DESCRIPTION = 'Join the Zulip community to contribute, ask questions, or provide feedback to the creators of Zulip.' %}{% block title %}<title>The Zulip development community</title>diff --git a/templates/corporate/features.html b/templates/corporate/features.htmlindex a2a4133b256..4a171f0e78e 100644--- a/templates/corporate/features.html+++ b/templates/corporate/features.html@@ -1,8 +1,8 @@{% extends "zerver/portico.html" %}{% set entrypoint = "landing-page" %}-{% set OPEN_GRAPH_TITLE = 'Zulip features' %}-{% set OPEN_GRAPH_DESCRIPTION = 'First class threading on top of everything you could want from real-time chat.' %}+{% set PAGE_TITLE = 'Zulip features' %}+{% set PAGE_DESCRIPTION = 'First class threading on top of everything you could want from real-time chat.' %}{% block portico_content %}diff --git a/templates/corporate/for/education.html b/templates/corporate/for/education.htmlindex 1389f71ad86..7ee2b38a570 100644--- a/templates/corporate/for/education.html+++ b/templates/corporate/for/education.html@@ -1,8 +1,8 @@{% extends "zerver/portico.html" %}{% set entrypoint = "landing-page" %}-{% set OPEN_GRAPH_TITLE = 'Teach a course with Zulip.' %}-{% set OPEN_GRAPH_DESCRIPTION = 'Online, in-person, and anything in between' %}+{% set PAGE_TITLE = 'Teach a course with Zulip.' %}+{% set PAGE_DESCRIPTION = 'Online, in-person, and anything in between' %}{% block title %}<title>Teach a course with Zulip for Education: Online, in-person, and anything in between</title>diff --git a/templates/corporate/for/events.html b/templates/corporate/for/events.htmlindex 35005c8b5ac..3a0dfd278a4 100644--- a/templates/corporate/for/events.html+++ b/templates/corporate/for/events.html@@ -1,8 +1,8 @@{% extends "zerver/portico.html" %}{% set entrypoint = "landing-page" %}-{% set OPEN_GRAPH_TITLE = 'Zulip for conferences and events' %}-{% set OPEN_GRAPH_DESCRIPTION = 'Conferences, workshops, hackathons. In-person, online, and anything in between.' %}+{% set PAGE_TITLE = 'Zulip for conferences and events' %}+{% set PAGE_DESCRIPTION = 'Conferences, workshops, hackathons. In-person, online, and anything in between.' %}{% block title %}<title>Zulip for conferences and events: Conferences, workshops, hackathons. In-person, online, and anything in between.</title>diff --git a/templates/corporate/for/open-source.html b/templates/corporate/for/open-source.htmlindex f932b1fa15c..7d79112afd6 100644--- a/templates/corporate/for/open-source.html+++ b/templates/corporate/for/open-source.html@@ -1,8 +1,8 @@{% extends "zerver/portico.html" %}{% set entrypoint = "landing-page" %}-(% set OPEN_GRAPH_TITLE = 'Modern chat for open source' %}-{% set OPEN_GRAPH_DESCRIPTION = 'Zulip is the only modern team chat app that is ideal for both live and asynchronous conversations. Discuss issues, pull requests and feature ideas, engage with users, answer questions, and onboard new contributors.' %}+(% set PAGE_TITLE = 'Modern chat for open source' %}+{% set PAGE_DESCRIPTION = 'Zulip is the only modern team chat app that is ideal for both live and asynchronous conversations. Discuss issues, pull requests and feature ideas, engage with users, answer questions, and onboard new contributors.' %}{% block title %}<title>Zulip: the best group chat for open-source projects</title>diff --git a/templates/corporate/for/research.html b/templates/corporate/for/research.htmlindex 867e3107473..f293e1a11e6 100644--- a/templates/corporate/for/research.html+++ b/templates/corporate/for/research.html@@ -1,8 +1,8 @@{% extends "zerver/portico.html" %}{% set entrypoint = "landing-page" %}-{% set OPEN_GRAPH_TITLE = 'Zulip for research' %}-{% set OPEN_GRAPH_DESCRIPTION = 'Chat for your project, research group, department or scientific field' %}+{% set PAGE_TITLE = 'Zulip for research' %}+{% set PAGE_DESCRIPTION = 'Chat for your project, research group, department or scientific field' %}{% block title %}<title>Zulip for research: Chat for your project, research group, department or scientific field</title>diff --git a/templates/corporate/plans.html b/templates/corporate/plans.htmlindex 68e9d669af3..f93489f7854 100644--- a/templates/corporate/plans.html+++ b/templates/corporate/plans.html@@ -1,8 +1,8 @@{% extends "zerver/portico.html" %}{% set entrypoint = "landing-page" %}-{% set OPEN_GRAPH_TITLE = 'Zulip plans and pricing' %}-{% set OPEN_GRAPH_DESCRIPTION = 'Get started today.' %}+{% set PAGE_TITLE = 'Zulip plans and pricing' %}+{% set PAGE_DESCRIPTION = 'Get started today.' %}{% block title %}<title>Zulip plans and pricing</title>diff --git a/templates/corporate/self-hosting.html b/templates/corporate/self-hosting.htmlindex 66ce2a2ea61..a3e32900e10 100644--- a/templates/corporate/self-hosting.html+++ b/templates/corporate/self-hosting.html@@ -1,8 +1,8 @@{% extends "zerver/portico.html" %}{% set entrypoint = "landing-page" %}-{% set OPEN_GRAPH_TITLE = 'Self-host Zulip today.' %}-{% set OPEN_GRAPH_DESCRIPTION = 'Open-source software that provides enterprise-grade reliability and security.' %}+{% set PAGE_TITLE = 'Self-host Zulip today.' %}+{% set PAGE_DESCRIPTION = 'Open-source software that provides enterprise-grade reliability and security.' %}{% block title %}<title>Self-host Zulip today. Open-source software that provides enterprise-grade reliability and security.</title>diff --git a/templates/corporate/why-zulip.html b/templates/corporate/why-zulip.htmlindex 286f0116d51..faf97af3f30 100644--- a/templates/corporate/why-zulip.html+++ b/templates/corporate/why-zulip.html@@ -1,8 +1,8 @@{% extends "zerver/portico.html" %}{% set entrypoint = "landing-page" %}-{% set OPEN_GRAPH_TITLE = 'Team chat with first-class threading' %}-{% set OPEN_GRAPH_DESCRIPTION = 'Most team chats are overwhelming to keep up with. Zulip takes a different approach.' %}+{% set PAGE_TITLE = 'Team chat with first-class threading' %}+{% set PAGE_DESCRIPTION = 'Most team chats are overwhelming to keep up with. Zulip takes a different approach.' %}{% block title %}<title>The best group chat</title>diff --git a/templates/zerver/base.html b/templates/zerver/base.htmlindex d391078475f..39b38a4fe99 100644--- a/templates/zerver/base.html+++ b/templates/zerver/base.html@@ -9,8 +9,8 @@{% if user_profile and user_profile.realm.name %}<title>{{user_profile.realm.name}} - Zulip</title>{% else %}- {% if OPEN_GRAPH_TITLE %}- <title>{{ OPEN_GRAPH_TITLE }}</title>+ {% if PAGE_TITLE %}+ <title>{{ PAGE_TITLE }}</title>{% else %}<title>Zulip</title>{% endif %}diff --git a/templates/zerver/documentation_main.html b/templates/zerver/documentation_main.htmlindex f3f3b6f9d16..ba5d9f4a1cd 100644--- a/templates/zerver/documentation_main.html+++ b/templates/zerver/documentation_main.html@@ -3,7 +3,7 @@{# Zulip user and API documentation. #}{% block title %}-<title>{{ OPEN_GRAPH_TITLE }}</title>+<title>{{ PAGE_TITLE }}</title>{% endblock %}{% block portico_content %}diff --git a/templates/zerver/meta_tags.html b/templates/zerver/meta_tags.htmlindex 5a12ae3f4db..586d8a0f1c8 100644--- a/templates/zerver/meta_tags.html+++ b/templates/zerver/meta_tags.html@@ -1,7 +1,7 @@<!-- Google / search engine tags -->{% if allow_search_engine_indexing %}- {% if OPEN_GRAPH_DESCRIPTION %}- <meta name="description" content="{{ OPEN_GRAPH_DESCRIPTION }}" />+ {% if PAGE_DESCRIPTION %}+ <meta name="description" content="{{ PAGE_DESCRIPTION }}" />{% else %}<meta name="description" content="Zulip combines the immediacy of real-time chat with an email threading model. With Zulip, you can catch up on important conversations while ignoring irrelevant ones." />{% endif %}@@ -10,18 +10,18 @@{% endif %}<!-- Open Graph / Facebook / Twitter meta tags -->-<meta property="og:url" content="{{ OPEN_GRAPH_URL }}" />+<meta property="og:url" content="{{ PAGE_METADATA_URL }}" /><meta property="og:type" content="website" /><meta property="og:site_name" content="Zulip" />-{% if OPEN_GRAPH_TITLE %}-<meta property="og:title" content="{{ OPEN_GRAPH_TITLE }}" />-<meta property="og:description" content="{{ OPEN_GRAPH_DESCRIPTION }}" />+{% if PAGE_TITLE %}+<meta property="og:title" content="{{ PAGE_TITLE }}" />+<meta property="og:description" content="{{ PAGE_DESCRIPTION }}" />{% else %}<meta property="og:title" content="Chat for distributed teams" /><meta property="og:description" content="Zulip combines the immediacy of real-time chat with an email threading model. With Zulip, you can catch up on important conversations while ignoring irrelevant ones." />{% endif %}-{% if OPEN_GRAPH_IMAGE %}-<meta property="og:image" content="{{ OPEN_GRAPH_IMAGE }}" />+{% if PAGE_METADATA_IMAGE %}+<meta property="og:image" content="{{ PAGE_METADATA_IMAGE }}" />{% else %}<meta property="og:image" content="{{ realm_uri }}/static/images/logo/zulip-icon-128x128.png" />{% endif %}diff --git a/zerver/context_processors.py b/zerver/context_processors.pyindex fa30d27f35f..328aea1b312 100644--- a/zerver/context_processors.py+++ b/zerver/context_processors.py@@ -180,9 +180,9 @@ def zulip_default_context(request: HttpRequest) -> Dict[str, Any]:"corporate_enabled": corporate_enabled,}- context["OPEN_GRAPH_URL"] = f"{realm_uri}{request.path}"+ context["PAGE_METADATA_URL"] = f"{realm_uri}{request.path}"if realm is not None and realm.icon_source == realm.ICON_UPLOADED:- context["OPEN_GRAPH_IMAGE"] = urljoin(realm_uri, realm_icon)+ context["PAGE_METADATA_IMAGE"] = urljoin(realm_uri, realm_icon)return context@@ -211,8 +211,8 @@ def login_context(request: HttpRequest) -> Dict[str, Any]:}if realm is not None and realm.description:- context["OPEN_GRAPH_TITLE"] = realm.name- context["OPEN_GRAPH_DESCRIPTION"] = get_realm_text_description(realm)+ context["PAGE_TITLE"] = realm.name+ context["PAGE_DESCRIPTION"] = get_realm_text_description(realm)# Add the keys for our standard authentication backends.no_auth_enabled = Truediff --git a/zerver/views/documentation.py b/zerver/views/documentation.pyindex 9353e63ea4f..4076e9ae20a 100644--- a/zerver/views/documentation.py+++ b/zerver/views/documentation.py@@ -198,21 +198,21 @@ class MarkdownDirectoryView(ApiURLView):elif (self.path_template == "/zerver/api/%s.md" and "{generate_api_header(" in first_line):- api_operation = context["OPEN_GRAPH_URL"].split("/api/")[1]+ api_operation = context["PAGE_METADATA_URL"].split("/api/")[1]endpoint_name, endpoint_method = get_endpoint_from_operationid(api_operation)article_title = get_openapi_summary(endpoint_name, endpoint_method)else:article_title = first_line.lstrip("#").strip()endpoint_name = endpoint_method = Noneif context["not_index_page"]:- context["OPEN_GRAPH_TITLE"] = f"{article_title} ({title_base})"+ context["PAGE_TITLE"] = f"{article_title} ({title_base})"else:- context["OPEN_GRAPH_TITLE"] = title_base+ context["PAGE_TITLE"] = title_baserequest_notes = RequestNotes.get_notes(self.request)request_notes.placeholder_open_graph_description = (- f"REPLACEMENT_OPEN_GRAPH_DESCRIPTION_{int(2**24 * random.random())}"+ f"REPLACEMENT_PAGE_DESCRIPTION_{int(2**24 * random.random())}")- context["OPEN_GRAPH_DESCRIPTION"] = request_notes.placeholder_open_graph_description+ context["PAGE_DESCRIPTION"] = request_notes.placeholder_open_graph_descriptioncontext["sidebar_index"] = sidebar_index# An "article" might require the api_uri_context to be rendered@@ -264,17 +264,17 @@ def add_integrations_open_graph_context(context: Dict[str, Any], request: HttpReif path_name in INTEGRATIONS:integration = INTEGRATIONS[path_name]- context["OPEN_GRAPH_TITLE"] = f"Connect {integration.display_name} to Zulip"- context["OPEN_GRAPH_DESCRIPTION"] = description+ context["PAGE_TITLE"] = f"Connect {integration.display_name} to Zulip"+ context["PAGE_DESCRIPTION"] = descriptionelif path_name in CATEGORIES:category = CATEGORIES[path_name]- context["OPEN_GRAPH_TITLE"] = f"Connect your {category} tools to Zulip"- context["OPEN_GRAPH_DESCRIPTION"] = description+ context["PAGE_TITLE"] = f"Connect your {category} tools to Zulip"+ context["PAGE_DESCRIPTION"] = descriptionelif path_name == "integrations":- context["OPEN_GRAPH_TITLE"] = "Connect the tools you use to Zulip"- context["OPEN_GRAPH_DESCRIPTION"] = description+ context["PAGE_TITLE"] = "Connect the tools you use to Zulip"+ context["PAGE_DESCRIPTION"] = descriptionclass IntegrationView(ApiURLView):