Skip to content

Commit cb72cd1

Browse files
committed
render entries in productchangelog and add rss feed
1 parent 99a02cc commit cb72cd1

File tree

10 files changed

+38
-26
lines changed

10 files changed

+38
-26
lines changed

src/components/ProductChangelog.astro

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,51 @@
22
import { getChangelogs, type GetChangelogsOptions } from "~/util/changelog";
33
import { reference } from "astro:content";
44
import { z } from "astro:schema";
5-
import { getCollection } from "astro:content";
5+
import { getCollection, render } from "astro:content";
6+
import { slug } from "github-slugger";
7+
import { LinkButton } from "@astrojs/starlight/components";
68
7-
const props = z.object({
8-
products: z.array(reference("products")),
9-
}).or(z.object({
10-
area: z.string()
11-
}));
9+
const props = z
10+
.object({
11+
product: reference("products"),
12+
})
13+
.or(
14+
z.object({
15+
area: z.string(),
16+
}),
17+
);
1218
1319
const input = await props.parseAsync(Astro.props);
1420
1521
let filter: GetChangelogsOptions["filter"];
22+
let rss: string;
23+
24+
if ("product" in input) {
25+
rss = `/changelog/rss/${input.product}.xml`;
1626
17-
if ("products" in input) {
1827
filter = (e) => {
19-
return e.data.products.some((x) => input.products.some((y) => x.id === y.id))
20-
}
28+
return e.data.products.some(({ id }) => id === input.product.id);
29+
};
2130
} else {
31+
rss = `/changelog/rss/${slug(input.area)}.xml`;
32+
2233
const products = await getCollection("products", (e) => {
2334
return e.data.product.group === input.area;
2435
});
2536
2637
filter = (e) => {
27-
return e.data.products.some((x) => products.some((y) => x.id === y.id))
28-
}
38+
return e.data.products.some((x) => products.some((y) => x.id === y.id));
39+
};
2940
}
3041
3142
const changelogs = await getChangelogs({ filter });
3243
---
3344

45+
<LinkButton href={rss} target="_blank">Subscribe to RSS</LinkButton>
46+
3447
{
35-
changelogs.map((entry) => (
36-
<h3>{entry.data.date.toISOString().slice(0, 10)}</h3>
37-
<h4>{entry.data.description}</h4>
38-
<p>For more information, refer to the <a href={`/changelog/${entry.id}`}>dedicated changelog post</a>.</p>
39-
))
40-
}
48+
changelogs.map(async (entry) => {
49+
const { Content } = await render(entry);
50+
return <Content />;
51+
})
52+
}

src/content/docs/cloudflare-one/changelog/access.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ description: Review recent changes to Cloudflare Access.
1010

1111
import { ProductChangelog } from "~/components"
1212

13-
<ProductChangelog products={["access"]} />
13+
<ProductChangelog product="access" />

src/content/docs/cloudflare-one/changelog/browser-isolation.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ description: Review recent changes to Cloudflare Browser Isolation.
1010

1111
import { ProductChangelog } from "~/components"
1212

13-
<ProductChangelog products={["browser-isolation"]} />
13+
<ProductChangelog product="browser-isolation" />

src/content/docs/cloudflare-one/changelog/casb.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ description: Review recent changes to Cloudflare CASB.
1010

1111
import { ProductChangelog } from "~/components"
1212

13-
<ProductChangelog products={["casb"]} />
13+
<ProductChangelog product="casb" />

src/content/docs/cloudflare-one/changelog/dex.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ description: Review recent changes to Digital Experience Monitoring.
1010

1111
import { ProductChangelog } from "~/components"
1212

13-
<ProductChangelog products={["dex"]} />
13+
<ProductChangelog product="dex" />

src/content/docs/cloudflare-one/changelog/dlp.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ description: Review recent changes to Cloudflare DLP.
1010

1111
import { ProductChangelog } from "~/components"
1212

13-
<ProductChangelog products={["dlp"]} />
13+
<ProductChangelog product="dlp" />

src/content/docs/cloudflare-one/changelog/email-security.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ title: Email Security
55

66
import { ProductChangelog } from "~/components"
77

8-
<ProductChangelog products={["email-security"]} />
8+
<ProductChangelog product="email-security" />

src/content/docs/cloudflare-one/changelog/gateway.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ description: Review recent changes to Cloudflare Gateway.
1010

1111
import { ProductChangelog } from "~/components"
1212

13-
<ProductChangelog products={["gateway"]} />
13+
<ProductChangelog product="gateway" />

src/content/docs/cloudflare-one/changelog/risk-score.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ description: Review recent changes to Cloudflare Zero Trust user risk scoring.
99

1010
import { ProductChangelog } from "~/components"
1111

12-
<ProductChangelog products={["risk-score"]} />
12+
<ProductChangelog product="risk-score" />

src/content/docs/cloudflare-one/changelog/tunnel.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ description: Review recent changes to Cloudflare Tunnel.
1010

1111
import { ProductChangelog } from "~/components"
1212

13-
<ProductChangelog products={["tunnel"]} />
13+
<ProductChangelog product="tunnel" />

0 commit comments

Comments
 (0)