REFACTOR Handling a dedicated template part for index panel

This commit is contained in:
Nonimart 2025-06-24 14:48:12 +02:00
parent 15619b08a2
commit 5c8409c10b

View File

@ -29,37 +29,7 @@
<input type="text" placeholder="Rechercher"> <input type="text" placeholder="Rechercher">
</div> </div>
<div class="index-panel"> <?php get_template_part('template-parts/articles/index-panel'); ?>
<div class="index-panel__header">
<button class="focus" data-index="sommaire" aria-selected="true" aria-controls="sommaire-index">
Résumé
</button>
<button class="focus" data-index="footnotes" aria-selected="false" aria-controls="footnotes-index">
Notes de bas de page
</button>
</div>
<div class="index-panel__content">
<ul data-index="sommaire" class="sommaire-index" aria-hidden="false">
<?php
$sommaire = build_sommaire_from_content(get_the_ID());
foreach ($sommaire as $chapter) {
echo '<li><a href="#' . $chapter['anchor'] . '">' . $chapter['title'] . '</a></li>';
}
?>
</ul>
<ul id="footnotes-index" data-index="footnotes" class="footnotes-index" aria-hidden="true">
<?php
$footnotes = build_footnotes_index_from_content(get_the_content());
?>
<?php foreach ($footnotes as $footnote) : ?>
<li><a href="#footnote-<?php echo $footnote['anchorID']; ?>" class="footnote-reference-item"><?php echo $footnote['content']; ?></a></li>
<?php endforeach; ?>
</div>
</div>
</aside> </aside>
<div class="content-area"> <div class="content-area">