Skip to content
This repository has been archived by the owner on Aug 26, 2022. It is now read-only.

Commit

Permalink
Bug 1423716: stop adding the SEO root title to all document titles
Browse files Browse the repository at this point in the history
We currently constuct the <title> of a document like this:

  <title> - <SEO root document title> | MDN

So for https://developer.mozilla.org/en-US/docs/Learn/CSS we have:

  Learn to style HTML using CSS - Learn web development | MDN

This patch shortens the title by removing the SEO root title, leaving:

  Learn to style HTML using CSS | MDN
  • Loading branch information
David Flanagan committed Nov 28, 2018
1 parent b415f84 commit f80d3f5
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 29 deletions.
2 changes: 1 addition & 1 deletion kuma/wiki/jinja2/wiki/document.html
@@ -1,5 +1,5 @@
{% extends "wiki/base.html" %}
{% block title %}{{ page_title(document.title + seo_parent_title) }}{% endblock %}
{% block title %}{{ page_title(document.title) }}{% endblock %}

{% from "wiki/includes/document_macros.html" import build_document_crumbs, get_document_quick_links, document_watch, contributor_links with context %}
{% from "wiki/includes/buttons.html" import get_document_buttons with context %}
Expand Down
28 changes: 0 additions & 28 deletions kuma/wiki/views/document.py
Expand Up @@ -111,29 +111,6 @@ def _make_doc_structure(document, level, expand, depth):
return result


def _get_seo_parent_title(document, slug_dict, document_locale):
"""
Get parent-title information for SEO purposes.
"""
seo_doc_slug = slug_dict['seo_root']
seo_root_doc = None

if seo_doc_slug:
# If the SEO root doc is the parent topic, save a query
if document.parent_topic_id and document.parent_topic.slug == seo_doc_slug:
seo_root_doc = document.parent_topic
else:
try:
seo_root_doc = Document.objects.only('title').get(locale=document_locale, slug=seo_doc_slug)
except Document.DoesNotExist:
pass

if seo_root_doc:
return u' - {}'.format(seo_root_doc.title)
else:
return ''


def _filter_doc_html(request, doc, doc_html, rendering_params):
"""
Apply needed filtering/annotating operations to a Document's HTML.
Expand Down Expand Up @@ -705,10 +682,6 @@ def document(request, document_slug, document_locale):
# Get the SEO summary
seo_summary = doc.get_summary_text()

# Get the additional title information, if necessary.
seo_parent_title = _get_seo_parent_title(
original_doc, slug_dict, document_locale)

# Retrieve pre-parsed content hunks
quick_links_html = doc.get_quick_links_html()
body_html = doc.get_body_html()
Expand Down Expand Up @@ -752,7 +725,6 @@ def document(request, document_slug, document_locale):
),
'render_raw_fallback': rendering_params['render_raw_fallback'],
'seo_summary': seo_summary,
'seo_parent_title': seo_parent_title,
'share_text': share_text,
'search_url': get_search_url_from_referer(request) or '',
'analytics_page_revision': doc.current_revision_id,
Expand Down

0 comments on commit f80d3f5

Please sign in to comment.