@@ -4,6 +4,7 @@ import { Aside } from "~/components";
44import { marked } from " marked" ;
55import { format } from " date-fns" ;
66import { getChangelogs } from " ~/util/changelogs" ;
7+ import { getEntry } from " astro:content" ;
78
89const { 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 ))
0 commit comments