Descripción
Add a Table of Contents block to your posts and pages. The TOC is a nested list of links to all heading found in the post or page. To use it, simply add a block and search for “SimpleTOC” or just “TOC”.
The maximum depth of the toc can be configured in in the blocks’ sidebar among many other options. There can hide the headline “Table of Contents” and add your own by using a normal heading block.
Cree una nueva instancia de WordPress con el plugin SimpleTOC ya instalado.
User Feedback
“It is lightweight, stable, and fully compatible with WordPress Full Site Editing. A reliable solution that integrates seamlessly and performs exactly as expected.”
— @js100 on wordpress.org“Does the job perfectly, and adds no bloat.”
— @clicknathan on wordpress.org“Simple yet powerful. Great plugin that does exactly what you need.”
— @mixey on wordpress.org
Accesibilidad
This plugin is designed & developed for WCAG 2.2 level AA conformance. The plugin is tested with assistive technology and intended to be accessible, however some third party plugins or themes may affect the individual accessibility on a given website. If you find an accessibility issue, please let us know and we’ll try to address it promptly.
Hidden TOCs use native <details> and <summary> semantics without extra ARIA references that require custom IDs.
Características
- Diseñado para Gutenberg.
- Zero configuration: Add the SimpleTOC block to your post and that’s it.
- Salida HTML mínima y válida.
- Utiliza la etiqueta nativa “details” del navegador para ofrecer una interfaz plegable.
- No JavaScript or CSS by default. Optional features such as the accordion menu, smooth scrolling, or box style add minimal assets only when enabled.
- Optional Box style in Gutenberg’s Styles tab with a default gray background.
- Native text, link, background, spacing, and typography controls.
- Global block styling through theme.json.
- Hereda el estilo de tu tema.
- Smooth scrolling effect using CSS.
- Accesibilidad integrada siguiendo los estándares web.
- Standard Gutenberg block wrapper with navigation role and ARIA label attributes.
- Traducido a múltiples idiomas, incluidos alemán, japonés, chino (Taiwán), neerlandés, portugués de Brasil, francés, español y letón.
- Ideal para crear una sección de preguntas frecuentes en su sitio web.
Personalización
- Administrators can utilize global settings to supersede the individual block settings.
- Set text, link, and background colors in Gutenberg’s Styles tab.
- Compatibilidad nativa de bloque para ancho amplio y ancho completo.
- Set vertical margins and padding with native spacing controls.
- Control the maximum depth of the headings.
- Choose between an ordered, bullet HTML list. Or indent the list.
- Select the Box style directly in Gutenberg’s Styles tab.
- Select a heading level or turn it into a paragraph.
- Disable the h2 heading of the TOC block and add your own.
Compatibilidad
- Compatibilidad con GeneratePress y Rank Math.
- Funciona con los principales plugins AMP.
How to contribute
SimpleTOC is open-source and developed on GitHub Pages. If you find a bug or have an idea for a feature please feel free to contribute and create a pull request.
Créditos
Muchas gracias a Tom J Nowell y a Sally CJ, quienes me ayudaron enormemente con mis preguntas en wordpress.stackexchange.com.
And many more thanks to all the developers on GitHub who helped me making SimpleTOC what it is today!
Gracias a Quintus Valerius Soranus por inventar la tabla de contenidos alrededor del año 100 a. C.
Capturas de pantalla
Bloques
Este plugin proporciona 1 bloque.
- SimpleTOC Adds a Table of Contents.
Instalación
SimpleTOC se puede encontrar e instalar a través del menú “Plugins” dentro de la administración de WordPress (Plugins -> Agregar nuevo). Como alternativa, se puede descargar desde WordPress.org e instalarlo manualmente…
En Gutenberg, agrega un bloque y busca “SimpleTOC” o simplemente “TOC”. Por favor, guarda tu contenido antes de que uses el bloque.
FAQ
-
Configuración de ajustes globales en SimpleTOC
-
SimpleTOC allows you to configure global settings for your WordPress website. These settings can be enforced globally, overriding any block-level configurations that may exist. To access these settings, navigate to the SimpleTOC section of the WordPress Settings.
-
How do I add colors or the Box style to SimpleTOC?
-
Select the SimpleTOC block and open Gutenberg’s Styles tab. Choose the Box style or use the native color controls to set text, link, and background colors. Native spacing controls are available for vertical margins and padding.
-
¿Cómo excluir un único encabezado de la tabla de contenidos?
-
If you really want to hide a single heading from the table of contents, then add the CSS class “simpletoc-hidden” to a heading block. You can find this field in the same place as the HTML anchor field: In the Block > Advanced sidebar. But first, think about the reason you would like to hide a specific heading. Maybe you would like to remove all headings of a specific depth level. Then there is an option for that in the blocks options in Gutenberg. If you think this heading should not be part of the toc perhaps it is not needed in the post itself?
-
I would like to save my SimpleTOC settings as default. Is that possible?
-
You can convert your configured SimpleTOC block into a reusable block in Gutenberg. It will keep its settings. This way, you can use your desired settings for each new post by adding the reusable block.
-
How can I style SimpleTOC through theme.json?
-
Add styles for the
simpletoc/tocblock to your theme.json. SimpleTOC uses the standard Gutenberg block wrapper and supports native colors, vertical margins, padding, font size, and line height settings.The following example sets default colors, spacing, and typography for every SimpleTOC block:
{ "$schema": "https://schemas.wp.org/trunk/theme.json", "version": 3, "styles": { "blocks": { "simpletoc/toc": { "color": { "background": "#f5f5f5", "text": "#1e1e1e" }, "elements": { "link": { "color": { "text": "#0057b8" } } }, "spacing": { "margin": { "top": "1.5rem", "bottom": "1.5rem" }, "padding": { "top": "1rem", "right": "1rem", "bottom": "1rem", "left": "1rem" } }, "typography": { "fontSize": "1rem", "lineHeight": "1.6" } } } } }Replace the example values with your theme’s values or preset variables. Selecting the Box style adds the standard
is-style-boxedclass. -
¿Cómo permitir que los desarrolladores excluyan encabezados de forma programática?
-
Use the ‘simpletoc_excluded_blocks’ filter. For example, this code will exclude heading blocks that are inside a column block.
Ejemplo:
add_filter( 'simpletoc_excluded_blocks', function ( array $blocks ) { $blocks[] = 'core/column'; return $blocks; } ); -
The heavy plus character I used can not be colored with css without hacks. But you can change the icon to something else and change the color of the new icon.
.simpletoc-collapsible::after { content: "✖"; color: #e94c89; } -
¿Cómo agregar SimpleTOC automáticamente a todos los artículos?
-
No veo una solución sencilla por el momento. SimpleTOC es únicamente un bloque que se puede agregar manualmente a cada entrada. Si existiera un plugin que añadiera bloques automáticamente a todas las entradas, esa sería la solución. Considero que esto debería ser un plugin independiente para mantener el código de SimpleTOC limpio y, en fin, simple.
Reseñas
Colaboradores & Desarrolladores
“SimpleTOC – Table of Contents Block” es software de código abierto. Las siguientes personas han contribuido a este plugin.
Colaboradores“SimpleTOC – Table of Contents Block” ha sido traducido en 19 idiomas. Gracias a los traductores por sus contribuciones.
Traduce “SimpleTOC – Table of Contents Block” a tu idioma.
¿Interesado en el desarrollo?
Revisa el código, echa un vistazo al repositorio SVN, o suscríbete al registro de desarrollo por RSS .
Historial de cambios
7.3.0
- Changed: Box is now a native Gutenberg block style in the Styles tab.
- Added: Native text, link, background color, margin, and padding controls.
- Added: theme.json styling support for colors, spacing, and typography.
- Added: WordPress 7.1 support and automated compatibility tests.
- Changed: Existing box-style blocks and the global Force box style setting remain compatible.
- Thanks: Lovro Hrust (@lovor) for the theme.json and block styling feedback.
