Skip to content

Commit

Permalink
feat(experiment): rewrite Web/API page titles (#10926)
Browse files Browse the repository at this point in the history
Problem: We identified a drop in search engine impressions in April 2023, which coincides 
with the Web/API retitle project (mdn/mdn#284), and we cannot 
rule out that there is a causal relationship.

Solution: Run an experiment with 500 randomly sampled Web/API pages (of 2719 affected), 
partially reverting  the change to their `<title>` (but not to the `<h1>`) by essentially 
replacing `Foo: bar property` with `Foo.bar property`.
  • Loading branch information
caugner authored Apr 18, 2024
1 parent 7229dd3 commit d8173cc
Show file tree
Hide file tree
Showing 2 changed files with 529 additions and 1 deletion.
4 changes: 3 additions & 1 deletion build/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import {
postProcessSmallerHeadingIDs,
} from "./utils.js";
import { getWebFeatureStatus } from "./web-features.js";
import { rewritePageTitleForSEO } from "./seo.js";
export { default as SearchIndex } from "./search-index.js";
export { gather as gatherGitHistory } from "./git-history.js";
export { buildSPAs } from "./spas.js";
Expand Down Expand Up @@ -536,7 +537,8 @@ export async function buildDocument(
// a breadcrumb in the React component.
addBreadcrumbData(document.url, doc);

doc.pageTitle = getPageTitle(doc);
const pageTitle = getPageTitle(doc);
doc.pageTitle = rewritePageTitleForSEO(doc.mdn_url, pageTitle);

// Decide whether it should be indexed (sitemaps, robots meta tag, search-index)
doc.noIndexing =
Expand Down
Loading

0 comments on commit d8173cc

Please sign in to comment.