Skip to content

Commit 522e760

Browse files
kodster28maxvp
authored andcommitted
[Chore] Make 'product' required param for Render component (#24627)
* [Chore] Make 'product' required param for Render component * Fixes * final bits * style guide tweak
1 parent a9a9e44 commit 522e760

File tree

19 files changed

+58
-39
lines changed

19 files changed

+58
-39
lines changed

src/components/Render.astro

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,14 @@ type Props = z.infer<typeof props>;
66
77
const props = z.object({
88
file: z.string(),
9-
product: z.string().optional(),
9+
product: z.string(),
1010
params: z.record(z.string(), z.any()).optional(),
1111
});
1212
1313
let { file, product, params } = props.parse(Astro.props);
1414
15-
if (!product) {
16-
const fromSlug = Astro.params.slug?.split("/")[0];
17-
18-
if (!fromSlug) {
19-
throw new Error(
20-
`[Render] Unable to infer which folder ${file} is in, please provide a "product" input with your "file" input.`,
21-
);
22-
}
23-
24-
product = fromSlug;
25-
}
26-
2715
const id = `${product}/${file}`;
28-
const partial = await getEntry("partials", id);
16+
let partial = await getEntry("partials", id);
2917
3018
if (!partial) {
3119
throw new Error(

src/content/docs/cloudflare-for-platforms/cloudflare-for-saas/saas-customers/provider-guides/webflow.mdx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ description: Learn how to configure your Enterprise zone with Webflow.
99

1010
import { Render } from "~/components";
1111

12-
<Render file="provider-guide-intro" params={{ providerName: "Webflow" }} />
12+
<Render
13+
file="provider-guide-intro"
14+
params={{ providerName: "Webflow" }}
15+
product="cloudflare-for-platforms"
16+
/>
1317

1418
## Benefits
1519

@@ -38,7 +42,11 @@ To enable O2O on your account, [create](/dns/manage-dns-records/how-to/create-dn
3842

3943
## Additional support
4044

41-
<Render file="provider-guide-help" params={{ providerName: "Webflow" }} />
45+
<Render
46+
file="provider-guide-help"
47+
params={{ providerName: "Webflow" }}
48+
product="cloudflare-for-platforms"
49+
/>
4250

4351
### DNS CAA records
4452

src/content/docs/cloudflare-one/applications/casb/casb-integrations/microsoft-365/sharepoint.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { Render } from "~/components";
1010

1111
<Render
1212
file="casb/microsoft/integrations/sharepoint"
13+
product="cloudflare-one"
1314
params={{
1415
integrationName: "SharePoint",
1516
environmentName: "Microsoft 365 account",

src/content/docs/cloudflare-one/policies/gateway/http-policies/index.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -611,11 +611,11 @@ The HTTP response status code received by the traffic.
611611

612612
### Source Continent
613613

614-
The continent of the user making the request. <Render file="gateway/selectors/source-continent" params={{ one: "http.src_ip" }} />
614+
The continent of the user making the request. <Render file="gateway/selectors/source-continent" product="cloudflare-one" params={{ one: "http.src_ip" }} />
615615

616616
### Source Country
617617

618-
The country of the user making the request. <Render file="gateway/selectors/source-country" params={{ one: "http.src_ip" }} />
618+
The country of the user making the request. <Render file="gateway/selectors/source-country" product="cloudflare-one" params={{ one: "http.src_ip" }} />
619619

620620
### Source Internal IP
621621

src/content/docs/cloudflare-one/policies/gateway/network-policies/index.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,11 +355,11 @@ By default, this selector only applies to HTTPS traffic on port `443`. To inspec
355355

356356
### Source Continent
357357

358-
The continent of the user making the request. <Render file="gateway/selectors/source-continent" params={{ one: "net.src" }} />
358+
The continent of the user making the request. <Render file="gateway/selectors/source-continent" product="cloudflare-one" params={{ one: "net.src" }} />
359359

360360
### Source Country
361361

362-
The country of the user making the request. <Render file="gateway/selectors/source-country" params={{ one: "net.src" }} />
362+
The country of the user making the request. <Render file="gateway/selectors/source-country" product="cloudflare-one" params={{ one: "net.src" }} />
363363

364364
### Source Internal IP
365365

src/content/docs/rules/transform/managed-transforms/reference.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ This page lists the available Managed Transforms. They can modify HTTP request h
1212

1313
<Render
1414
file="snippets-alternative"
15+
product="rules"
1516
params={{ suffix: "and customized header modifications" }}
1617
/>
1718

src/content/docs/style-guide/components/render.mdx

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -30,24 +30,9 @@ import { Render } from "~/components";
3030

3131
This should be the name of the partial, without the containing directory or file extension. For example, `/partials/style-guide/hello.mdx` would be `file="hello"`.
3232

33-
- `product` <Type text="string" /> <MetaInfo text="optional" />
33+
- `product` <Type text="string" />
3434

35-
By default, it will look for partials in the same product folder as the current page. You can use this to specify a different product.
36-
37-
:::caution
38-
39-
When using the `Render` component inside partials, the original `product` is lost.
40-
41-
For example, if there are three files:
42-
1. `docs/fundamentals/index.mdx`
43-
2. `partials/dns/thing.mdx`
44-
3. `partials/dns/thing2.mdx`
45-
46-
`docs/fundamentals/index.mdx` uses `<Render file="thing" product="dns" />`
47-
48-
`partials/dns/thing.mdx` must use `<Render file="thing2" product="dns" />` as `product` cannot be inferred.
49-
50-
:::
35+
This should be the folder within `src/partials`.
5136

5237
- `params` <Type text="object" /> <MetaInfo text="optional" />
5338

src/content/partials/cloudflare-one/casb/google/integrations/gmail.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { Render } from "~/components";
99

1010
<Render
1111
file="casb/integration-description"
12+
product="cloudflare-one"
1213
params={{
1314
integrationName: props.integrationName,
1415
integrationAccountType: props.environmentName,
@@ -23,6 +24,7 @@ import { Render } from "~/components";
2324

2425
<Render
2526
file="casb/integration-perms"
27+
product="cloudflare-one"
2628
params={{
2729
parentIntegration: "Google Workspace",
2830
parentSlug: "google-workspace",
@@ -33,6 +35,7 @@ import { Render } from "~/components";
3335

3436
<Render
3537
file="casb/security-findings"
38+
product="cloudflare-one"
3639
params={{
3740
integrationName: props.integrationName,
3841
slugRelativePath: props.slugifiedName,

src/content/partials/cloudflare-one/casb/google/integrations/google-admin.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { Render } from "~/components";
99

1010
<Render
1111
file="casb/integration-description"
12+
product="cloudflare-one"
1213
params={{
1314
integrationName: props.integrationName,
1415
integrationAccountType: props.environmentName,
@@ -23,6 +24,7 @@ import { Render } from "~/components";
2324

2425
<Render
2526
file="casb/integration-perms"
27+
product="cloudflare-one"
2628
params={{
2729
parentIntegration: "Google Workspace",
2830
parentSlug: "google-workspace",
@@ -33,6 +35,7 @@ import { Render } from "~/components";
3335

3436
<Render
3537
file="casb/security-findings"
38+
product="cloudflare-one"
3639
params={{
3740
integrationName: props.integrationName,
3841
slugRelativePath: props.slugifiedName,

src/content/partials/cloudflare-one/casb/google/integrations/google-calendar.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { Render } from "~/components";
99

1010
<Render
1111
file="casb/integration-description"
12+
product="cloudflare-one"
1213
params={{
1314
integrationName: props.integrationName,
1415
integrationAccountType: props.environmentName,
@@ -23,6 +24,7 @@ import { Render } from "~/components";
2324

2425
<Render
2526
file="casb/integration-perms"
27+
product="cloudflare-one"
2628
params={{
2729
parentIntegration: "Google Workspace",
2830
parentSlug: "google-workspace",
@@ -33,6 +35,7 @@ import { Render } from "~/components";
3335

3436
<Render
3537
file="casb/security-findings"
38+
product="cloudflare-one"
3639
params={{
3740
integrationName: props.integrationName,
3841
slugRelativePath: props.slugifiedName,

0 commit comments

Comments
 (0)