Site logo

Archived topic

Table of content on Archive pages

3 replies · Started by Marcell on February 19, 2021

Viewing posts 1–4 of 4

Hey,

I want to put Table of Contents (ToC+) on top of my category archives. The idea is, that the plugin collects all headlines and make a google-friendy Table of Contents with all headlines on the archive page.

So far I have created:
- New element "Hook"
- Display Hook: generate_before_main_content
- Execute Shortcodes: Checked
- Show on all category archive pages

I have also (for testing purposes) created a ToC+ sitemap and added it also as shortcode into the element:
<p>[toc]</p>
<p>[sitemap]</p>

Screenshot: https://ibb.co/QjtCVPT

But on the archive pages only the (test) sitemap shows up, no Table of Content at all
Also the content is on the left side, it should be above the main content :-(
Example URL: https://www.onlinesuperhelden.de/seo/

Screenshot: https://ibb.co/r5y49bh

Do you have any ideas to fix this?

Thanks in advance, all the best,
Marcell

Hi there,

Table of Contents plugins only work on single post types ( post / pages ) - as they parse the post content for heading elements. There isn't any ToC plugin to my knowledge that works on archives.

To correct the position of the Site Map, first add this CSS:

.top-container {
  width: 100%;
  padding: 0 50px;
}

Then in your hook element, wrap your shortcode in a <div> with a class of top-container eg.

<div class="top-container">
Add your shortcode here 
</div>

Hi David,

thanks for the quick response. The sitemap was only for shortcode testing purposes, So there is no need to move it around. I am sure I have seen an archive page with the ToC+ over it enabled somewhere, but I cant remember where. Too bad.

I did have a look around but couldn't find any that supported archives.
Sorry can't be of much help here.

This archived topic is closed to new replies.