mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	templates: Rename OPEN_GRAPH variables to PAGE or PAGE_METADATA.
				
					
				
			Renames existing template variables starting with `OPEN_GRAPH` to be either `PAGE` or `PAGE_METADATA` since these variables are used for adding both open graph metdata and page titles/descriptions for SEO.
This commit is contained in:
		
				
					committed by
					
						
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							18b401f476
						
					
				
				
					commit
					049302fe61
				
			@@ -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" />
 | 
			
		||||
 
 | 
			
		||||
@@ -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>
 | 
			
		||||
 
 | 
			
		||||
@@ -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 %}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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>
 | 
			
		||||
 
 | 
			
		||||
@@ -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>
 | 
			
		||||
 
 | 
			
		||||
@@ -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>
 | 
			
		||||
 
 | 
			
		||||
@@ -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>
 | 
			
		||||
 
 | 
			
		||||
@@ -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>
 | 
			
		||||
 
 | 
			
		||||
@@ -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>
 | 
			
		||||
 
 | 
			
		||||
@@ -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>
 | 
			
		||||
 
 | 
			
		||||
@@ -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 %}
 | 
			
		||||
 
 | 
			
		||||
@@ -3,7 +3,7 @@
 | 
			
		||||
 | 
			
		||||
{# Zulip user and API documentation. #}
 | 
			
		||||
{% block title %}
 | 
			
		||||
<title>{{ OPEN_GRAPH_TITLE }}</title>
 | 
			
		||||
<title>{{ PAGE_TITLE }}</title>
 | 
			
		||||
{% endblock %}
 | 
			
		||||
 | 
			
		||||
{% block portico_content %}
 | 
			
		||||
 
 | 
			
		||||
@@ -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 %}
 | 
			
		||||
 
 | 
			
		||||
@@ -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 = True
 | 
			
		||||
 
 | 
			
		||||
@@ -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 = None
 | 
			
		||||
            if 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_base
 | 
			
		||||
            request_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_description
 | 
			
		||||
 | 
			
		||||
        context["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: HttpRe
 | 
			
		||||
 | 
			
		||||
    if 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"] = description
 | 
			
		||||
 | 
			
		||||
    elif 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"] = description
 | 
			
		||||
 | 
			
		||||
    elif 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"] = description
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class IntegrationView(ApiURLView):
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user