SimpleTOC – 目次ブロック

説明

投稿やページに目次ブロックを追加します。TOC は、記事またはページで見つかったすべての見出しへのリンクのネストされたリストです。これを使うには、ブロックを追加して「SimpleTOC」または単に「TOC」を検索するだけです。

ブロックのサイドバーで目次の最大深度を設定することができます。「目次」という見出しを非表示にして、通常の見出しブロックを使って独自の見出しを追加することができます。

SimpleTOC がインストールされた状態の、新しい WordPress インスタンスを起動する

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

Accessibility

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.

機能

  • Gutenberg のために設計されています。
  • 設定はゼロ: SimpleTOC ブロックを投稿に追加するだけです。
  • 最小限かつ有効な HTML 出力。
  • Utilizes the browser’s built-in details tag for a collapsible interface.
  • 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.
  • テーマのスタイルを継承します。
  • Smooth scrolling effect using CSS.
  • Accessibility built-in by following web standards.
  • Standard Gutenberg block wrapper with navigation role and ARIA label attributes.
  • 複数の言語に翻訳されています。以下を含みます: ドイツ語、日本語、中国語(繁体字)、オランダ語、ブラジルポルトガル語、フランス語、スペイン語、ラトビア語。
  • Ideal for creating a Frequently Asked Questions section on your website.

カスタマイズ

  • Administrators can utilize global settings to supersede the individual block settings.
  • Set text, link, and background colors in Gutenberg’s Styles tab.
  • ワイドとフルワイドのネイティブブロックに対応。
  • Set vertical margins and padding with native spacing controls.
  • 見出しの最大深度を制御します。
  • 順序付きリスト、箇条書きリストから選択できます。リストをインデントできます。
  • Select the Box style directly in Gutenberg’s Styles tab.
  • 見出しレベルを選択することや、段落にすることができます。
  • TOC ブロックの h2 見出しを無効にして、独自の見出しを追加します。

互換性

  • GeneratePress と Rank Math に対応。
  • 人気の AMP プラグインに対応。

How to contribute

SimpleTOC はオープンソースで、GitHub Pages で開発されています。もしバグを見つけたり、機能のアイディアがあれば、お気軽に貢献し、プルリクエストを作成してください。

クレジット

Tom J Nowell と Sally CJ には、wordpress.stackexchange.com での私の質問をたくさん助けてもらいました。

And many more thanks to all the developers on GitHub who helped me making SimpleTOC what it is today!

紀元前100年頃、目次を発明したクイントゥス・ヴァレリウス・ソラヌスに感謝します。

スクリーンショット

ブロック

このプラグインは1個のブロックを提供します。

  • SimpleTOC Adds a Table of Contents.

インストール

SimpleTOC は WordPress の管理画面内のプラグインメニュー (プラグイン -> 新規追加) からインストールすることができます。または、WordPress.org からダウンロードし、手動でインストールすることもできます。

Gutenberg でブロックを追加し、”SimpleTOC” または単に “TOC” を検索してください。ブロックを使用する前に、コンテンツを保存してください。

FAQ

Configuring Global Settings in 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.

目次から一つの見出しを隠すには、どのようにすれば良いですか ?

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/toc block 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-boxed class.

How to allow developers to exclude specific headings programmatically?

Use the ‘simpletoc_excluded_blocks’ filter. For example, this code will exclude heading blocks that are inside a column block.

例:

add_filter( 'simpletoc_excluded_blocks', function ( array $blocks ) {
    $blocks[] = 'core/column';

    return $blocks;
} );

How do I change the color of the accordion menu?

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;
}

すべての記事に SimpleTOC を自動的に追加するにはどうすればよいですか ?

I don’t see an easy solution at the moment. SimpleTOC is only a block that can be placed in your post. If there was a plugin that adds blocks to every post, then this would be the solution. I think this should be another separate plug-in to keep the code of SimpleTOC clean and … well, simple.

評価

2026年8月21日 1 reply
I just wished this block would follow good practices for developing blocks. I was wondering why I can’t style it through theme.json and discovered that it hasn’t standard block wrapper. After inspecting block code, I found that it uses get_block_wrapper_attributes() function, but optionally. After finding that option digged under advanced block settings, I was able to style it like I do other blocks. Otherwise, this is a great block plugin.
2026年1月7日 1 reply
Does the job with no fuss. I feel that the option to include a basic show/hide button (no animations or other bloat necessary) would add a great deal of polish for very little impact. But, the plugin advertises itself as something that is minimalist, no CSS, no JS, and that is what it is. The links also follow the CSS rules from the site theme which is strangely not the case for other TOC plugins. Well done this dev.
2025年11月29日 1 reply
The plugin works exceptionally well. It is lightweight, stable, and fully compatible with WordPress Full Site Editing. A reliable solution that integrates seamlessly and performs exactly as expected.
2025年5月13日 1 reply
Comparing this to the “Table Of Contents Block” by WPDeveloper, I prefer this one because: It just works automatically. It has less options, but just enough to do what you need. It adds nothing to the frontend to cause bloat. No CSS, no JS. At least not right out of the box. Additional settings can be enabled that will add these, but it’s nice that we have the option! This is an example of what a well-written plugin should be.
77件のレビューをすべて表示

貢献者と開発者

SimpleTOC – 目次ブロック はオープンソースソフトウェアです。以下の人々がこのプラグインに貢献しています。

貢献者

“SimpleTOC – 目次ブロック” は19ロケールに翻訳されています。 翻訳者のみなさん、翻訳へのご協力ありがとうございます。

“SimpleTOC – 目次ブロック” をあなたの言語に翻訳しましょう。

開発に興味がありますか ?

コードを閲覧するか、SVN リポジトリをチェックするか、開発ログRSS で購読してみてください。

変更履歴

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.
Sponsor
SponsoredKunjungi sekarang
Promo