Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 19 additions & 10 deletions src/components/ProductChangelog.astro
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ if (!changelogs) {
}
---

{
page.data.pcx_content_type === "changelog" && (
<p>
<a href={`/${page.slug}/index.xml`}>Subscribe to RSS</a>
</p>
)
}
{
changelogs.map(([date, entries]) => (
<div data-date={date}>
Expand Down Expand Up @@ -104,16 +111,18 @@ if (!changelogs) {
} else {
description = marked.parse(entry.description as string);
return (
<AnchorHeading depth={2} title={date} />
<div data-product={entry.product.toLowerCase()}>
{page.data.changelog_product_area_name && (
<h3 class="!mt-4">
<a href={entry.productLink}>{entry.product}</a>
</h3>
)}
{entry.title && <strong>{entry.title}</strong>}
{<Fragment set:html={description} />}
</div>
<>
<AnchorHeading depth={2} title={date} />
<div data-product={entry.product.toLowerCase()}>
{page.data.changelog_product_area_name && (
<h3 class="!mt-4">
<a href={entry.productLink}>{entry.product}</a>
</h3>
)}
{entry.title && <strong>{entry.title}</strong>}
{<Fragment set:html={description} />}
</div>
</>
);
}
})}
Expand Down
74 changes: 38 additions & 36 deletions src/pages/changelog/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Aside } from "~/components";
import { marked } from "marked";
import { format } from "date-fns";
import { getChangelogs } from "~/util/changelogs";
import { getEntry } from "astro:content";

const { products, productAreas, changelogs } = await getChangelogs();
---
Expand Down Expand Up @@ -52,42 +53,43 @@ const { products, productAreas, changelogs } = await getChangelogs();
<h4 class="text-nowrap">{format(date, "do MMMM yyyy")}</h4>
</div>
<div class="!mt-0">
{entries?.map((entry) => (
<div
data-product={entry.product.toLowerCase()}
data-productArea={entry.productAreaName.toLowerCase()}
>
<h3>
<a href={entry.link}>{entry.product}</a>
</h3>
{["WAF", "DDoS protection"].includes(entry.product) && (
<p
set:html={marked.parse(
entry.scheduled
? "**" +
"Scheduled changes for " +
(entry.date ?? "") +
"**"
: "**" + (entry.date ?? "") + "**",
)}
/>
)}
{entry.title && (
<p set:html={marked.parse("**" + (entry.title ?? "") + "**")} />
)}
{["WAF", "DDoS protection"].includes(entry.product) ? (
<p
set:html={marked.parse(
"For more details, refer to the [changelog page](" +
entry.link +
").",
)}
/>
) : (
<p set:html={marked.parse(entry.description ?? "")} />
)}
</div>
))}
{entries?.map(async (entry) => {
let title = entry.title;
let description = entry.description || "";

if (entry.individual_page) {
const page = await getEntry(
"docs",
entry.individual_page.slice(1, -1),
);

if (!page) {
throw new Error(
`[Changelog] Unable to load page ${entry.individual_page}.`,
);
}

title = `${entry.product} - ${page.data.title}`;
description = `For more details, refer to the dedicated page for [${title}](${entry.individual_page}).`;
}

return (
<div
data-product={entry.product.toLowerCase()}
data-productArea={entry.productAreaName.toLowerCase()}
>
<h3>
<a href={entry.productLink}>{entry.product}</a>
</h3>
{title && (
<p>
<strong>{title}</strong>
</p>
)}
<Fragment set:html={marked.parse(description)} />
</div>
);
})}
</div>
</div>
))
Expand Down
2 changes: 1 addition & 1 deletion src/util/changelogs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export async function getWranglerChangelog(): Promise<
CollectionEntry<"changelogs">
> {
const response = await fetch(
"https://api.github.com/repos/cloudflare/workers-sdk/releases",
"https://api.github.com/repos/cloudflare/workers-sdk/releases?per_page=100",
);

if (!response.ok) {
Expand Down
Loading