Summary: Provides an in-post/page index for WordPress.
Table of Contents
WordPress Article Table of Contents Plugin
Content Index For WordPress
Summary: Adds a content index to posts in the form of anchor text. It can be configured in the admin dashboard to control the display style. After many revisions, the current result is fairly satisfactory.
Overview
After seeing this feature on Baidu Baike, I felt it was quite necessary, especially for longer articles. I had also seen similar plugins on WordPress.org, but they could not be configured, so making one myself felt more reliable and easier to modify ^ ^~
Besides, it can add some internal links, anchor text, and keywords. In any case, having them is better than not having them.
Current Version
2.43
In Future Versions
If something already appears in the usage instructions, it means it has already been implemented~
- Add an effect that follows the screen while scrolling: A blogger requested this, and it has already been implemented. I am considering adding it~ (tested, currently shelved while I consider a solution)
- Return to index menu, back to top, quick index: Similar to Baidu Baike.
- Add activation modes: Enabled by default with an option to disable it in posts; disabled by default with an option to enable it in posts.
- Add an option to enable caching: The plugin performs a large amount of computation when generating the table of contents. With caching enabled, the index can be stored in the database when a post is published, skipping the analysis and calculation process during display. Some bloggers have encountered PHP memory overflow issues before, and this option can help alleviate such problems. PS: Curses on those hosting providers who cram unlimited Apache virtual hosts onto one server... they will not even spare enough resources to run another Apache instance!!
Demo
Ah... well... this post is the best demo. More specific usage instructions and demonstrations follow below.
Usage Instructions
Plugin Settings
Go to the WordPress admin dashboard and choose "Settings -> In-Post Index".
- Position: Sets where the index bar appears in the post. Left and right placement both make the article text wrap around it and occupy part of the article area; choosing top displays it below the post title and above the content (excerpt), without taking up space inside the article body.
- Add numbering to the index: Whether to add numbers before index items. If different tags from
h1toh5appear, the plugin will automatically identify them and display the hierarchy. - Add numbering to headings in the body: Implements a paragraph-numbering feature similar to Office.
- Title: The title of the index bar, which can be enabled or disabled. If this option is enabled, you can also set the display text as needed; if it is empty, the plugin's default text, "In-Post Index," will be displayed.
- Hierarchy: Whether to display indentation between different levels. When this feature is enabled, for example with "4" and "4.1", "4.1" will be indented relative to its parent "4" both visually and in the code structure. When disabled, all index items will be displayed in natural order: 1, 2, 3, 4, 5, 6... likewise both visually and in the code.
- Hide button: Whether to display a hide button and enable the function for hiding the index bar. This setting is mainly intended to reduce the impact of an overly long or wide index bar on the article content, making it easier for users to read after closing it.
- Show empty content items: Whether to display empty index entries. If you add
<h3></h3>to a post and the tag contains no content, the plugin will still create an index entry for this tag; its name is generated automatically through numbering. - Show index (empty) items: Whether to display empty items that indicate hierarchy but have no practical meaning. See the example:
<h2>Index 2</h2>
<h3>Index 3</h3>
When h2 is followed directly by h3, a hierarchy such as 1 and 1.1 will be displayed.
But if another situation occurs, such as:
<h2>Index 2</h2>
<h4>Index 4</h4>
When h2 is followed by h4, the normal hierarchy does not really make sense, because one h3 level is missing in between. However, the plugin will still display 1 and 1.1.1. There is an automatically added "1.1" between them. This 1.1 is the object controlled by this option.
- Excerpt-related: Every post can have an excerpt. If you have not written an excerpt, this option will have no effect. In other words, this option only applies to posts that have an excerpt. When the first-level option is enabled, the excerpt will automatically be displayed at the top of the post; when the second-level option is enabled, the excerpt will appear as the first item in the index bar.
The CSS styles used by the plugin are stored in an independent stylesheet and are not controlled from the admin dashboard. The stylesheet is currently loaded automatically. If you need to customize it, please reset the styles in your WordPress theme stylesheet.
Using It in Posts
Add h1 through h6 tags to the post, and the plugin will automatically identify the hierarchy and output it according to the settings.
Starting from version 2.42, you can disable it within individual posts! If a certain post or page should not use this feature, you can check the option to block it.
Plugin File List
style.css: Default styles, now set to load automatically.wp-content-index.php: Main plugin file.wp-content-index-zh_CN.*o: Language pack... only Chinese. Well, Chinese alone is enough.
Plugin Download
Local download: http://olseeling.qjwm.com/down_1145215.html
Official download: http://wordpress.org/extend/plugins/wp-content-index/
JQuery Content Directory
Click to read: http://earn.yesmall.biz/?p=357
jQuery Table of Contents
Click to read: http://earn.yesmall.biz/?p=351
WP-TOC
http://wordpress.org/extend/plugins/wp-toc/
After activating this plugin, insert the following into a post:
[toc=2]
That is all. 2 means h2, h3, h4, and so on will all be inserted into the table of contents, and so forth.
[toc=3]
This means h3, h4, and so on will all be inserted into the table of contents.
Others
Click to read: http://earn.yesmall.biz/?p=375
