Skip to content

Commit 8d0e218

Browse files
committed
[Docs Site] Various changelog improvements
1 parent 56f7b86 commit 8d0e218

File tree

3 files changed

+58
-47
lines changed

3 files changed

+58
-47
lines changed

src/components/ProductChangelog.astro

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,13 @@ if (!changelogs) {
6565
}
6666
---
6767

68+
{
69+
page.data.pcx_content_type === "changelog" && (
70+
<p>
71+
<a href={`/${page.slug}/index.xml`}>Subscribe to RSS</a>
72+
</p>
73+
)
74+
}
6875
{
6976
changelogs.map(([date, entries]) => (
7077
<div data-date={date}>
@@ -104,16 +111,18 @@ if (!changelogs) {
104111
} else {
105112
description = marked.parse(entry.description as string);
106113
return (
107-
<AnchorHeading depth={2} title={date} />
108-
<div data-product={entry.product.toLowerCase()}>
109-
{page.data.changelog_product_area_name && (
110-
<h3 class="!mt-4">
111-
<a href={entry.productLink}>{entry.product}</a>
112-
</h3>
113-
)}
114-
{entry.title && <strong>{entry.title}</strong>}
115-
{<Fragment set:html={description} />}
116-
</div>
114+
<>
115+
<AnchorHeading depth={2} title={date} />
116+
<div data-product={entry.product.toLowerCase()}>
117+
{page.data.changelog_product_area_name && (
118+
<h3 class="!mt-4">
119+
<a href={entry.productLink}>{entry.product}</a>
120+
</h3>
121+
)}
122+
{entry.title && <strong>{entry.title}</strong>}
123+
{<Fragment set:html={description} />}
124+
</div>
125+
</>
117126
);
118127
}
119128
})}

src/pages/changelog/index.astro

Lines changed: 38 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { Aside } from "~/components";
44
import { marked } from "marked";
55
import { format } from "date-fns";
66
import { getChangelogs } from "~/util/changelogs";
7+
import { getEntry } from "astro:content";
78
89
const { products, productAreas, changelogs } = await getChangelogs();
910
---
@@ -52,42 +53,43 @@ const { products, productAreas, changelogs } = await getChangelogs();
5253
<h4 class="text-nowrap">{format(date, "do MMMM yyyy")}</h4>
5354
</div>
5455
<div class="!mt-0">
55-
{entries?.map((entry) => (
56-
<div
57-
data-product={entry.product.toLowerCase()}
58-
data-productArea={entry.productAreaName.toLowerCase()}
59-
>
60-
<h3>
61-
<a href={entry.link}>{entry.product}</a>
62-
</h3>
63-
{["WAF", "DDoS protection"].includes(entry.product) && (
64-
<p
65-
set:html={marked.parse(
66-
entry.scheduled
67-
? "**" +
68-
"Scheduled changes for " +
69-
(entry.date ?? "") +
70-
"**"
71-
: "**" + (entry.date ?? "") + "**",
72-
)}
73-
/>
74-
)}
75-
{entry.title && (
76-
<p set:html={marked.parse("**" + (entry.title ?? "") + "**")} />
77-
)}
78-
{["WAF", "DDoS protection"].includes(entry.product) ? (
79-
<p
80-
set:html={marked.parse(
81-
"For more details, refer to the [changelog page](" +
82-
entry.link +
83-
").",
84-
)}
85-
/>
86-
) : (
87-
<p set:html={marked.parse(entry.description ?? "")} />
88-
)}
89-
</div>
90-
))}
56+
{entries?.map(async (entry) => {
57+
let title = entry.title;
58+
let description = entry.description || "";
59+
60+
if (entry.individual_page) {
61+
const page = await getEntry(
62+
"docs",
63+
entry.individual_page.slice(1, -1),
64+
);
65+
66+
if (!page) {
67+
throw new Error(
68+
`[Changelog] Unable to load page ${entry.individual_page}.`,
69+
);
70+
}
71+
72+
title = `${entry.product} - ${page.data.title}`;
73+
description = `For more details, refer to the dedicated page for [${title}](${entry.individual_page}).`;
74+
}
75+
76+
return (
77+
<div
78+
data-product={entry.product.toLowerCase()}
79+
data-productArea={entry.productAreaName.toLowerCase()}
80+
>
81+
<h3>
82+
<a href={entry.productLink}>{entry.product}</a>
83+
</h3>
84+
{title && (
85+
<p>
86+
<strong>{title}</strong>
87+
</p>
88+
)}
89+
<Fragment set:html={marked.parse(description)} />
90+
</div>
91+
);
92+
})}
9193
</div>
9294
</div>
9395
))

src/util/changelogs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export async function getWranglerChangelog(): Promise<
6161
CollectionEntry<"changelogs">
6262
> {
6363
const response = await fetch(
64-
"https://api.github.com/repos/cloudflare/workers-sdk/releases",
64+
"https://api.github.com/repos/cloudflare/workers-sdk/releases?per_page=100",
6565
);
6666

6767
if (!response.ok) {

0 commit comments

Comments
 (0)