Skip to content

Commit

Permalink
[Docs Site] Append product meta suffix to custom titles (#18445)
Browse files Browse the repository at this point in the history
  • Loading branch information
KianNH authored Nov 29, 2024
1 parent 9520778 commit 067c8e7
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 13 deletions.
30 changes: 24 additions & 6 deletions src/components/overrides/Head.astro
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,30 @@ if (currentSection) {
if (product) {
if (product.data.meta.title) {
const title = `${Astro.props.entry.data.title} | ${product.data.meta.title}`;
Astro.props.entry.data.head.push({
tag: "title",
attrs: {},
content: title,
});
const titleIdx = Astro.props.entry.data.head.findIndex(
(x) => x.tag === "title",
);
let title: string;
if (titleIdx !== -1) {
const existingTitle = Astro.props.entry.data.head[titleIdx].content;
title = `${existingTitle} · ${product.data.meta.title}`;
Astro.props.entry.data.head[titleIdx] = {
tag: "title",
attrs: {},
content: title,
};
} else {
title = `${Astro.props.entry.data.title} · ${product.data.meta.title}`;
Astro.props.entry.data.head.push({
tag: "title",
attrs: {},
content: title,
});
}
Astro.props.entry.data.head.push({
tag: "meta",
attrs: { property: "og:title", content: title },
Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/aegis/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ sidebar:
order: 1
head:
- tag: title
content: Overview | Cloudflare Aegis docs
content: Overview
---

import { CardGrid, Description, GlossaryTooltip, LinkTitleCard, Plan, RelatedProduct } from "~/components"
Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/china-network/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ sidebar:
order: 1
head:
- tag: title
content: Overview | Cloudflare China Network
content: Overview
---

import { Stream } from "~/components"
Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/page-shield/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ sidebar:
order: 1
head:
- tag: title
content: Overview | Cloudflare Page Shield
content: Overview
description: Page Shield is a comprehensive client-side security and privacy
solution that allows you to ensure the safety of your website visitors'
browsing environment.
Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/rules/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ sidebar:
order: 1
head:
- tag: title
content: Overview | Cloudflare Rules
content: Overview
---

import {
Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/ruleset-engine/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ sidebar:
order: 2
head:
- tag: title
content: Overview | Cloudflare Ruleset Engine
content: Overview
---

import { LinkButton } from "~/components";
Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/ssl/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ sidebar:
order: 1
head:
- tag: title
content: Overview | Cloudflare SSL/TLS docs
content: Overview
description: Cloudflare SSL/TLS offers free Universal SSL alongside advanced and enterprise features to meet your encryption and certificate management needs.
---

Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/waf/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ sidebar:
order: 1
head:
- tag: title
content: Overview | Cloudflare Web Application Firewall
content: Overview
description: The Cloudflare Web Application Firewall (WAF) provides automatic
protection from vulnerabilities and the flexibility to create custom rules.
---
Expand Down

0 comments on commit 067c8e7

Please sign in to comment.