SimpleTOC – 目次ブロック

説明

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

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

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

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

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.

機能

  • Gutenberg のために設計されています。
  • 設定はゼロ: SimpleTOC ブロックを投稿に追加するだけです。
  • 最小限かつ有効な HTML 出力。
  • Utilizes the browser’s built-in details tag for a collapsible interface.
  • アコーディオンメニューを有効にしない限り、JavaScript や CSS を一切使用しません。
  • Gutenberg のネイティブグループスタイリングオプションで SimpleTOC をスタイリングします。
  • テーマのスタイルを継承します。
  • Smooth scrolling effect using CSS.
  • Optional ARIA Label and navigation role attributes.
  • 複数の言語に翻訳されています。以下を含みます: ドイツ語、日本語、中国語(繁体字)、オランダ語、ブラジルポルトガル語、フランス語、スペイン語、ラトビア語。
  • Ideal for creating a Frequently Asked Questions section on your website.

カスタマイズ

  • Administrators can utilize global settings to supersede the individual block settings.
  • Gutenberg のグループを使って背景色や文字色を追加。
  • ワイドとフルワイドのネイティブブロックに対応。
  • 見出しの最大深度を制御します。
  • 順序付きリスト、箇条書きリストから選択できます。リストをインデントできます。
  • 見出しレベルを選択することや、段落にすることができます。
  • TOC ブロックの h2 見出しを無効にして、独自の見出しを追加します。

互換性

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

クレジット

このプラグインは、pdewouters からフォークし、Easy-Table-of-Contents のコードを使用しています。

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

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

スクリーンショット

  • Gutenberg エディターの SimpleTOC ブロック。
  • 投稿内の SimpleTOC。
  • シンプルでパワフル。各目次を好きなようにカスタマイズ。
  • 見出しの最大深度を制御します。
  • SimpleTOC styled with Gutenbergs native group styles.
  • SimpleTOC Advanced 機能
  • Gutenberg Heading block: Set a custom anchor
  • SimpleTOC hidden in the accordion menu.
  • SimpleTOC global settings.

ブロック

このプラグインは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.

Gutenberg のグループを使って SimpleTOC に背景色を追加するにはどうすればよいですか ?

ブロックを選択し、コンテキストメニューから「グループ」を選択します。このグループに「背景色」、「リンク色」、「文字色」を適用します。SimpleTOC にこれらのスタイルが継承されます。このスタイルが適用されたSimpleTOC グループを、次に記事を書くときに使いたいですか ? 再利用可能なブロックに変換してください。

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

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 to add a div tag wrapper to the TOC?

If you add a custom class to the SimpleTOC block in “Advanced” and then “Additional CSS Class(es)” a div with that class will be wrapped around the HTML output.

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.

評価

2025年1月11日
Ich hatte den Button erst gar nicht gefunden / übersehen unter “Blöcke” -> “Design” -> “SimpleTOC”.Klein und fein, wirklich zu empfehlen…
2024年11月5日
This is an excellent plugin that easily adds table of contents in your posts / pages and it provides links to the relevant headings. Does exactly what I want and I would highly recommend it if you are looking for an easy to use tale of contents block plugin. Thanks so much for sharing.
2024年11月4日
Profile bio appears to be a newly established website that focuses on creating bios for various social media platforms such as Instagram, Facebook, and WhatsApp. The site aims to assist users in crafting concise and engaging personal or professional bios, which are essential for making a good first impression online​
2024年10月20日 1 reply
I genuinely appreicate the the SimpleTOC plugin – I use it for my site and it fits in seamlessly. It is a great example of a perfect plugin. And I look forward to contributing to its code in a few months. I have a really bad case of a wonderful domain I got from someone who used it badly and who got that domain semi-blacklisted so I get no SEO traffic at all and SimpleTOC has been one of the highpoints for my users that I get from LinkedIn that in the end result means they stay on average on the page three and a half minutes (3:30+, I think recently it was 3:13 if I excluded suspicious traffic). Some posts get average of five minutes plus. People underestimate time on site and engagement in general but in particular how a small addition like a table of contents can add to the website and customer experience.
72件のレビューをすべて表示

貢献者と開発者

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

貢献者

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

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

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

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

変更履歴

6.7.2

  • Added: Support for GenerateBlocks 2.0. Thanks @blronaldhuereca
  • Added: Included an accessibility statement in the plugin description. Thanks Gen Herres.

6.6.1

  • Added: Initialize the JavaScript for the TOC accordion on page load or after the document has fully loaded. Thanks blronaldhuereca https://github.com/mtoensing/simpletoc/pull/63

6.6.0

  • Added: Testest compatibility with WordPress 6.7

6.5.6

  • Fixed: All script versions have been updated to prevent caching issues.
  • Fixed: Legacy Accordion was always expanded. Thanks Francesco Palmieri.
  • Added: Updated dependencies for improved performance and stability.​
  • Added: Testest compatibility with WordPress 6.6

6.4.3

  • Added: A pointer cursor on hover for the hidden TOC

6.4.3

  • Added: Utilizes the browser’s built-in details tag for a collapsible interface. Thanks @infinitnet
  • Compatibility with WordPress 6.5
  • Fixed: Minor localization problems.

6.3.2

  • Fixed: Option for automatic refresh did not work in some instances.

6.3.0

  • Added: Option for automatic refresh. This can be disabled in the blocks advanced settings.
  • Added: Option to globally disable automatic refresh in the WordPress SimpleTOC settings.

6.2.0

  • Added: Implemented smooth animation for improved user interaction in the accordion menu.
  • Added: Upgraded styling of the accordion menu for a more visually appealing and modern user experience.

6.1.0

  • Fixed: Broken markup when tags closed for headers below minimum. Thanks @harmoney !

6.0.10

  • Added aria-hidden attribute to icon in accordion. Thanks Alex Stine!

6.0.9

  • Added ARIA accessibility labels for the accordion. Thanks Amber Hinds!
  • Fixed: Caching of accordion JavaScript. Thanks jghitchcock!
  • Added correct ARIA controls attribute.