Skip to content

Commit 7e97154

Browse files
authored
Merge branch 'production' into dpena/youtube-link-swap
2 parents 7cb92d8 + 418661a commit 7e97154

File tree

51 files changed

+4593
-214
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+4593
-214
lines changed

astro.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ export default defineConfig({
142142
"{props.*}",
143143
"/",
144144
"/glossary/",
145-
"/products/",
145+
"/directory/",
146146
"/rules/snippets/examples/?operation=*",
147147
"/rules/transform/examples/?operation=*",
148148
"/ruleset-engine/rules-language/fields/reference/**",

public/__redirects

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# homepage
22
/api /api/ 301
3-
/docs/ /products/ 301
3+
/docs/ /directory/ 301
4+
/products/ /directory/ 301
45
/zero-trust/ /products/?product-group=Cloudflare+One 301
56
/dashboard-landing/ / 301
67
/tutorials/ /search/?content_type%5B0%5D=Tutorial 301

src/components/ProductCatalog.tsx renamed to src/components/DirectoryCatalog.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ type Filters = {
1313
groups: string[];
1414
};
1515

16-
const ProductCatalog = ({ products }: { products: ProductData[] }) => {
16+
const DirectoryCatalog = ({ products }: { products: ProductData[] }) => {
1717
const [filters, setFilters] = useState<Filters>({
1818
search: "",
1919
groups: [],
@@ -74,7 +74,7 @@ const ProductCatalog = ({ products }: { products: ProductData[] }) => {
7474
<input
7575
type="text"
7676
className="mb-8 w-full rounded-md border-2 border-gray-200 bg-white px-2 py-2 dark:border-gray-700 dark:bg-gray-800"
77-
placeholder="Search products"
77+
placeholder="Search folders"
7878
value={filters.search}
7979
onChange={(e) => setFilters({ ...filters, search: e.target.value })}
8080
/>
@@ -116,7 +116,7 @@ const ProductCatalog = ({ products }: { products: ProductData[] }) => {
116116
<div className="mt-0! grid w-full grid-cols-1 items-stretch gap-2 self-start md:grid-cols-2 lg:w-3/4 lg:grid-cols-3 lg:gap-4">
117117
{productList.length === 0 && (
118118
<div className="flex w-full flex-col justify-center rounded-md border bg-gray-50 py-6 text-center align-middle md:col-span-2 lg:col-span-3 dark:border-gray-500 dark:bg-gray-800">
119-
<span className="text-lg font-bold!">No products found</span>
119+
<span className="text-lg font-bold!">No folders found</span>
120120
<p>
121121
Try a different search term, or broaden your search by removing
122122
filters.
@@ -163,4 +163,4 @@ const ProductCatalog = ({ products }: { products: ProductData[] }) => {
163163
);
164164
};
165165

166-
export default ProductCatalog;
166+
export default DirectoryCatalog;

src/components/HeaderDropdowns.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { useState } from "react";
1111
import { PiCaretDownBold } from "react-icons/pi";
1212

1313
const links = [
14-
{ label: "Docs Directory", href: "/products/" },
14+
{ label: "Docs Directory", href: "/directory/" },
1515
{
1616
label: "APIs",
1717
href: "https://developers.cloudflare.com/api/",

src/components/HomepageHero.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ if (image) {
4545
<div class="sl-flex stack">
4646
<div class="sl-flex copy">
4747
<div class="sl-flex copy links space-x-4">
48-
<a href="/products/">Products</a>
48+
<a href="/directory/">Directory</a>
4949
<a href="/billing/">Subscriptions and billing</a>
5050
<a href="/api/">API</a>
5151
<a href="/changelog/">Changelog</a>

src/components/Stream.astro

Lines changed: 41 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import { z } from "astro:schema";
33
import { Badge } from "@astrojs/starlight/components";
44
import parse from "parse-duration";
5+
import Details from "./Details.astro";
56
67
type Props = z.input<typeof props>;
78
@@ -12,12 +13,12 @@ const props = z
1213
thumbnail: z.string().optional(),
1314
chapters: z.record(z.string(), z.string()).optional(),
1415
showMoreVideos: z.boolean().default(false),
16+
expandChapters: z.boolean().default(false),
1517
})
1618
.strict();
1719
18-
const { id, title, thumbnail, chapters, showMoreVideos } = props.parse(
19-
Astro.props,
20-
);
20+
const { id, title, thumbnail, chapters, showMoreVideos, expandChapters } =
21+
props.parse(Astro.props);
2122
2223
const BASE_URL = `https://customer-1mwganm1ma0xgnmj.cloudflarestream.com/`;
2324
@@ -53,42 +54,43 @@ if (thumbnail) {
5354

5455
{
5556
chapters && (
56-
<p>
57-
<strong>Chapters</strong>
58-
<ul class="flex list-none gap-4 overflow-x-scroll pb-4 pl-0">
59-
{Object.entries(chapters).map(([chapter, time]) => {
60-
const totalSeconds = parse(time, "s");
61-
62-
const thumbnail = new URL(thumbnailUrl);
63-
thumbnail.searchParams.set("fit", "crop");
64-
thumbnail.searchParams.set("time", `${totalSeconds}s`);
65-
66-
return (
67-
<li class="mt-0!">
68-
<button
69-
class="flex h-full w-36 cursor-pointer flex-col rounded-sm border border-gray-200 bg-transparent p-4 dark:border-gray-700"
70-
data-chapter={chapter}
71-
data-time={totalSeconds}
72-
>
73-
<img
74-
src={thumbnail.toString()}
75-
alt={chapter}
76-
width="120"
77-
height="64"
78-
class="border-accent bg-accent/10 rounded-sm border"
79-
/>
80-
<div class="flex h-full flex-col items-center justify-between">
81-
<strong class="line-clamp-2 text-xs" title={chapter}>
82-
{chapter}
83-
</strong>
84-
<Badge text={time} variant="tip" class="w-fit" />
85-
</div>
86-
</button>
87-
</li>
88-
);
89-
})}
90-
</ul>
91-
</p>
57+
<Details header="Chapters" open={expandChapters}>
58+
<p>
59+
<ul class="flex list-none gap-4 overflow-x-scroll pb-4 pl-0">
60+
{Object.entries(chapters).map(([chapter, time]) => {
61+
const totalSeconds = parse(time, "s");
62+
63+
const thumbnail = new URL(thumbnailUrl);
64+
thumbnail.searchParams.set("fit", "crop");
65+
thumbnail.searchParams.set("time", `${totalSeconds}s`);
66+
67+
return (
68+
<li class="mt-0!">
69+
<button
70+
class="flex h-full w-36 cursor-pointer flex-col rounded-sm border border-gray-200 bg-transparent p-4 dark:border-gray-700"
71+
data-chapter={chapter}
72+
data-time={totalSeconds}
73+
>
74+
<img
75+
src={thumbnail.toString()}
76+
alt={chapter}
77+
width="120"
78+
height="64"
79+
class="border-accent bg-accent/10 rounded-sm border"
80+
/>
81+
<div class="flex h-full flex-col items-center justify-between">
82+
<strong class="line-clamp-2 text-xs" title={chapter}>
83+
{chapter}
84+
</strong>
85+
<Badge text={time} variant="tip" class="w-fit" />
86+
</div>
87+
</button>
88+
</li>
89+
);
90+
})}
91+
</ul>
92+
</p>
93+
</Details>
9294
)
9395
}
9496

src/components/homepage/FeaturedContentSection.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ const { title, text, image, cards, imagePosition } = props.parse(Astro.props);
6363

6464
<LinkCard
6565
title={"Explore our Developer Platform"}
66-
href={"/products/?product-group=Developer+platform"}
66+
href={"/directory/?product-group=Developer+platform"}
6767
/>
6868
</Card>
6969
</div>

src/components/overrides/Footer.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const groups = Object.entries({
1313
text: "New to Cloudflare?",
1414
href: "/fundamentals/",
1515
},
16-
{ text: "Products", href: "/products/" },
16+
{ text: "Directory", href: "/directory/" },
1717
{
1818
text: "Sponsorships",
1919
href: "/sponsorships/",

src/components/overrides/Head.astro

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,26 +35,28 @@ if (currentSection) {
3535
let product = await getEntry("products", currentSection);
3636
// if entry for changelog, grab the first product value (which corresponds to the folder the entry is in) and use as the primary "product"
3737
if (currentSection === "changelog") {
38-
const products = frontmatter.products
38+
const products = frontmatter.products;
3939
if (products) {
4040
product = await getEntry("products", products[0]);
4141
}
4242
}
4343
4444
if (product) {
45-
let productMetaName = product.data.meta.title ? product.data.meta.title : "Cloudflare Docs";
45+
let productMetaName = product.data.meta.title
46+
? product.data.meta.title
47+
: "Cloudflare Docs";
4648
4749
if (currentSection === "changelog") {
48-
productMetaName = "Changelog"
50+
productMetaName = "Changelog";
4951
}
5052
5153
const titleIdx = head.findIndex((x) => x.tag === "title");
5254
let title: string;
5355
5456
// Prefer the title set via frontmatter.head.title. If not, grab the regular frontmatter title value.
55-
const existingTitle = head[titleIdx].content ? head[titleIdx].content?.split(
56-
` ${DEFAULT_TITLE_DELIMITER} `,
57-
)[0]: frontmatter.title;
57+
const existingTitle = head[titleIdx].content
58+
? head[titleIdx].content?.split(` ${DEFAULT_TITLE_DELIMITER} `)[0]
59+
: frontmatter.title;
5860
5961
title = `${existingTitle} · ${productMetaName}`;
6062
@@ -128,8 +130,13 @@ if (
128130
129131
if (frontmatter.pcx_content_type) {
130132
["pcx_content_type", "algolia_content_type"].map((name) => {
131-
const contentType = frontmatter.pcx_content_type
132-
const updatedName = contentType ? (contentType.charAt(0).toUpperCase() + contentType.slice(1)).replace("-", " ") : ""
133+
const contentType = frontmatter.pcx_content_type;
134+
const updatedName = contentType
135+
? (contentType.charAt(0).toUpperCase() + contentType.slice(1)).replace(
136+
"-",
137+
" ",
138+
)
139+
: "";
133140
metaTags.push({
134141
name,
135142
content: updatedName,
@@ -217,7 +224,6 @@ metaTags.map((attrs) => {
217224
attrs,
218225
});
219226
});
220-
221227
---
222228

223229
<script src="src/scripts/footnotes.ts"></script>

src/components/overrides/PageTitle.astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ const slug = Astro.locals.starlightRoute.entry.slug;
2525
const breadcrumbProps: Record<string, any> = {
2626
crumbs: [
2727
{
28-
text: "Products",
29-
href: "/products/",
28+
text: "Directory",
29+
href: "/directory/",
3030
},
3131
],
3232
truncated: true,

0 commit comments

Comments
 (0)