-
Afonso Alves
Hello everything is fine?
Is it possible to create a template content index that appears at the beginning of each article with generateblocks?
Example screenshot: https://prnt.sc/7iuTdeFz3AFH
-
Fernando
Hi there,
Are you referring to a Table of Content?
If so, you’ll need a plugin for that. A common plugin used is this: https://wordpress.org/plugins/easy-table-of-contents/
-
Afonso Alves
I’ve been facing a problem on my website that I don’t know how to resolve.
I use an article recommendation element on my website. It turns out that this table of contents plugin is inserting the recommended articles into the index as if they were part of the article.
Can you help me resolve the problem?
Link to an example page in private information.
-
Fernando
Are you referring to this: https://share.zight.com/geu17Bz5 in relation to this: https://share.zight.com/7KuXZnLG
It doesn’t seem to be including the “Recommended articles” in the ToC from my end.
-
Afonso Alves
The elements that are being included are these here: https://prnt.sc/nqgj9LAIspqz
-
Fernando
I see.
I’m afraid we have no solution to this.
You’ll need to ask the ToC support if there’s a way to exclude specific elements from being added to the ToC.
I found that East ToC has a filter for it:
ez_toc_exclude_by_selector
Example:
add_filter( 'ez_toc_exclude_by_selector', function( $selectors ) { $selectors['item-titles'] = '.cu-exclude-from-toc'; return $selectors; } );
This should exclude anything with class
cu-exclude-from-toc
.Adding Custom Classes: https://wordpress.com/support/wordpress-editor/adding-additional-css-classes-to-blocks/
-
Afonso Alves
The plugin I use is Lucky WP Table of Contents
-
Fernando
I see. It would be best to ask the support of that plugin if they have a function/filter hook to exclude specific elements from being added to the dynamic ToC.
-
Afonso Alves
Ok, I’ll ask, I’ll leave the ticket open so that as soon as they answer me, I’ll let you know here
-
Afonso Alves
I found a block to ignore texts. Can you tell me a name to put here to try and exclude it from the table?
Screenshot: https://prnt.sc/S_LNSOGg-lY8
-
Fernando
Sorry, I can’t understand what it says. What does this: https://share.zight.com/o0uKLOGK – say in English?
-
Afonso Alves
It says “Specify the titles (one per line) to exclude from the table of contents.
Use an asterisk * as a wildcard to match any text.” -
Fernando
I see. Try adding:
Como Aumentar o FPS no Roblox, Confira o Guia Atualizado!
there.
-
Afonso Alves
It’s not worth adding this way because every time I publish new articles, they change.
-
Hi there,
if you edit each of the GP Block elements that you’re using to hook in those related posts
Then select the Headline Block showing the H2 title, and give it the CSS Classrelated-post-title
Then ask the ToC plugin developer how to exclude all heading elements with the
related-post-title
class.
- You must be logged in to reply to this topic.