Skip to content

Commit d8173cc

Browse files
authored
feat(experiment): rewrite Web/API page titles (#10926)
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`.
1 parent 7229dd3 commit d8173cc

File tree

2 files changed

+529
-1
lines changed

2 files changed

+529
-1
lines changed

Diff for: build/index.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ import {
4444
postProcessSmallerHeadingIDs,
4545
} from "./utils.js";
4646
import { getWebFeatureStatus } from "./web-features.js";
47+
import { rewritePageTitleForSEO } from "./seo.js";
4748
export { default as SearchIndex } from "./search-index.js";
4849
export { gather as gatherGitHistory } from "./git-history.js";
4950
export { buildSPAs } from "./spas.js";
@@ -536,7 +537,8 @@ export async function buildDocument(
536537
// a breadcrumb in the React component.
537538
addBreadcrumbData(document.url, doc);
538539

539-
doc.pageTitle = getPageTitle(doc);
540+
const pageTitle = getPageTitle(doc);
541+
doc.pageTitle = rewritePageTitleForSEO(doc.mdn_url, pageTitle);
540542

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

0 commit comments

Comments
 (0)