File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import {
14
14
} from '@guardian/source/foundations' ;
15
15
import { ArticleDesign , type ArticleFormat } from '../lib/articleFormat' ;
16
16
import type { NestedArticleElement } from '../lib/renderElement' ;
17
+ import { slugify } from '../model/enhance-H2s' ;
17
18
import { palette } from '../palette' ;
18
19
import type {
19
20
DCRSectionedTimelineBlockElement ,
@@ -294,7 +295,11 @@ export const Timeline = ({
294
295
< >
295
296
{ timeline . sections . map ( ( section ) => (
296
297
< section key = { section . title } >
297
- < Subheading format = { format } topPadding = { false } >
298
+ < Subheading
299
+ format = { format }
300
+ topPadding = { false }
301
+ id = { slugify ( section . title ) }
302
+ >
298
303
{ section . title }
299
304
</ Subheading >
300
305
{ section . events . map ( ( event ) => (
Original file line number Diff line number Diff line change @@ -88,6 +88,16 @@ export const enhanceTableOfContents = (
88
88
title : multiByline . title ,
89
89
} ) ;
90
90
}
91
+ } else if (
92
+ element . _type ===
93
+ 'model.dotcomrendering.pageElements.DCRSectionedTimelineBlockElement'
94
+ ) {
95
+ for ( const section of element . sections ) {
96
+ tocItems . push ( {
97
+ id : slugify ( section . title ) ,
98
+ title : section . title ,
99
+ } ) ;
100
+ }
91
101
} else if (
92
102
element . _type ===
93
103
'model.dotcomrendering.pageElements.SubheadingBlockElement' ||
You can’t perform that action at this time.
0 commit comments