@@ -307,6 +307,7 @@ async function renderDocs(
307307async function rewriteIndexContents (
308308 partFilenames : ReadonlyMap < number , string > ,
309309 partTitles : ReadonlyMap < number , string > ,
310+ partObjectives : ReadonlyMap < number , string > ,
310311 partCounts : ReadonlyMap < number , number > ,
311312 docs : ReadonlyMap < string , DocEntry > ,
312313 tourDir : string ,
@@ -338,35 +339,40 @@ async function rewriteIndexContents(
338339
339340 // Build unified rows in stable order: parts 1..N first, then docs
340341 // in manifest order. Each row is a flat <div> carrying the same
341- // shape — title link + muted context line. Using <div>s (not <ul>/
342- // <li>) sidesteps the browser-default bullet rendering that made
343- // the old list look off-tempo.
342+ // shape — title link + muted description. Parts also get a lighter
343+ // "N sections" bonus annotation appended inline. Using <div>s (not
344+ // <ul>/<li>) sidesteps the browser-default bullet rendering that
345+ // made the old list look off-tempo.
346+ const renderRow = (
347+ href : string ,
348+ title : string ,
349+ description : string ,
350+ bonus ?: string ,
351+ ) : string => {
352+ const bonusHtml = bonus
353+ ? ` <span class="wt-contents-bonus">· ${ escapeHtml ( bonus ) } </span>`
354+ : ''
355+ return (
356+ ` <div class="wt-contents-row">\n` +
357+ ` <a class="wt-contents-title" href="${ href } ">${ escapeHtml ( title ) } </a>\n` +
358+ ( description
359+ ? ` <p class="wt-contents-summary">${ escapeHtml ( description ) } ${ bonusHtml } </p>\n`
360+ : '' ) +
361+ ` </div>`
362+ )
363+ }
344364 const rows : string [ ] = [ ]
345365 for ( const [ id , filename ] of [ ...partFilenames . entries ( ) ] . sort (
346366 ( a , b ) => a [ 0 ] - b [ 0 ] ,
347367 ) ) {
348368 const title = partTitles . get ( id ) ?? `Part ${ id } `
369+ const description = partObjectives . get ( id ) ?? ''
349370 const count = partCounts . get ( id )
350- const context = count !== undefined ? `${ count } sections` : ''
351- rows . push (
352- ` <div class="wt-contents-row">\n` +
353- ` <a class="wt-contents-title" href="/${ filename } .html">${ escapeHtml ( title ) } </a>\n` +
354- ( context
355- ? ` <p class="wt-contents-summary">${ context } </p>\n`
356- : '' ) +
357- ` </div>` ,
358- )
371+ const bonus = count !== undefined ? `${ count } sections` : undefined
372+ rows . push ( renderRow ( `/${ filename } .html` , title , description , bonus ) )
359373 }
360374 for ( const d of docs . values ( ) ) {
361- const context = d . summary ?? ''
362- rows . push (
363- ` <div class="wt-contents-row">\n` +
364- ` <a class="wt-contents-title" href="/${ d . filename } .html">${ escapeHtml ( d . title ) } </a>\n` +
365- ( context
366- ? ` <p class="wt-contents-summary">${ escapeHtml ( context ) } </p>\n`
367- : '' ) +
368- ` </div>` ,
369- )
375+ rows . push ( renderRow ( `/${ d . filename } .html` , d . title , d . summary ?? '' ) )
370376 }
371377 const blockHtml =
372378 ` <div class="wt-contents">\n` +
@@ -827,7 +833,12 @@ async function generate(
827833 ? ( JSON . parse ( await fs . readFile ( path . resolve ( configPath ) , 'utf8' ) ) as {
828834 slug ?: string
829835 commentBackend ?: string
830- parts ?: Array < { id : number ; title : string ; filename ?: string } >
836+ parts ?: Array < {
837+ id : number
838+ title : string
839+ filename ?: string
840+ objective ?: string
841+ } >
831842 docs ?: Array < {
832843 filename ?: string | undefined
833844 title ?: string | undefined
@@ -843,8 +854,12 @@ async function generate(
843854 // each pill as just "Part 1", "Part 2", …; with it, they get the
844855 // real section title ("Anatomy of a PURL" etc.).
845856 const partTitles = new Map < number , string > ( )
857+ const partObjectives = new Map < number , string > ( )
846858 for ( const p of tourConfig . parts ?? [ ] ) {
847859 partTitles . set ( p . id , p . title )
860+ if ( p . objective ) {
861+ partObjectives . set ( p . id , p . objective )
862+ }
848863 }
849864
850865 // Map part-id → filename (e.g. 1 → "anatomy"). Drives both the flat
@@ -906,6 +921,7 @@ async function generate(
906921 await rewriteIndexContents (
907922 partFilenames ,
908923 partTitles ,
924+ partObjectives ,
909925 partCounts ,
910926 docFilenames ,
911927 tourDir ,
0 commit comments