Skip to content

Commit 68cf3f2

Browse files
authored
[Docs Site] Various changelog improvements (#19362)
* [Docs Site] Various changelog improvements * open rss feed link in new tab
1 parent 1d0e119 commit 68cf3f2

File tree

3 files changed

+60
-47
lines changed

3 files changed

+60
-47
lines changed

src/components/ProductChangelog.astro

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

68+
{
69+
page.data.pcx_content_type === "changelog" && (
70+
<p>
71+
<a href={`/${page.slug}/index.xml`} target="_blank">
72+
Subscribe to RSS
73+
</a>
74+
</p>
75+
)
76+
}
6877
{
6978
changelogs.map(([date, entries]) => (
7079
<div data-date={date}>
@@ -104,16 +113,18 @@ if (!changelogs) {
104113
} else {
105114
description = marked.parse(entry.description as string);
106115
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>
116+
<>
117+
<AnchorHeading depth={2} title={date} />
118+
<div data-product={entry.product.toLowerCase()}>
119+
{page.data.changelog_product_area_name && (
120+
<h3 class="!mt-4">
121+
<a href={entry.productLink}>{entry.product}</a>
122+
</h3>
123+
)}
124+
{entry.title && <strong>{entry.title}</strong>}
125+
{<Fragment set:html={description} />}
126+
</div>
127+
</>
117128
);
118129
}
119130
})}

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)