@@ -153,8 +153,42 @@ const applyStyles = (element, styles) => {
153153 const timeAgo = calculateTimeAgo ( timeDifference , currentLang ) ;
154154 const timeAgoStr = ` (${ timeAgo } )` ;
155155
156- const updateInfo = document . createElement ( "p" ) ;
157- dataArticleDateElement . parentElement . appendChild ( updateInfo ) ;
156+ // Clone article-metadata-footer and create custom-header-from-article-metadata-footer
157+ let customContainer = document . getElementById ( 'custom-header-from-article-metadata-footer' ) ;
158+ const articleMetadata = document . getElementById ( 'article-metadata' ) ;
159+ const articleMetadataFooter = document . getElementById ( 'article-metadata-footer' ) ;
160+
161+ let updateInfo ;
162+ if ( ! customContainer && articleMetadata && articleMetadataFooter ) {
163+ customContainer = articleMetadataFooter . cloneNode ( true ) ;
164+ customContainer . id = 'custom-header-from-article-metadata-footer' ;
165+ customContainer . setAttribute ( 'data-bi-name' , 'custom-header-from-article-metadata-footer' ) ;
166+ customContainer . setAttribute ( 'data-test-id' , 'custom-header-from-article-metadata-footer' ) ;
167+ customContainer . className = 'custom-page-metadata-container' ;
168+
169+ // Update lang attribute
170+ const ul = customContainer . querySelector ( 'ul.metadata.page-metadata' ) ;
171+ if ( ul ) {
172+ ul . setAttribute ( 'lang' , currentLang ) ;
173+ }
174+
175+ // Add p tag after span.badge in li
176+ const li = customContainer . querySelector ( 'li.visibility-hidden-visual-diff' ) ;
177+ if ( li ) {
178+ updateInfo = document . createElement ( 'p' ) ;
179+ li . appendChild ( updateInfo ) ;
180+ }
181+
182+ articleMetadata . insertAdjacentElement ( 'afterend' , customContainer ) ;
183+ } else if ( customContainer ) {
184+ updateInfo = customContainer . querySelector ( 'li.visibility-hidden-visual-diff p' ) ;
185+ }
186+
187+ // Fallback: if custom container doesn't exist, use original implementation
188+ if ( ! updateInfo ) {
189+ updateInfo = document . createElement ( "p" ) ;
190+ dataArticleDateElement . parentElement . appendChild ( updateInfo ) ;
191+ }
158192
159193 const updateClass = ( ) => {
160194 // if theme is selected, apply appropriate text color based on theme
0 commit comments