LuckyWP Table of Contents

Mô tả

Tạo mục lục thân thiện SEO cho bài viết, trang hoặc custom post type. Giao diện rất đẹp.

Tính năng

  • Tự động chèn mục lục (cấu hình post type và vị trí).
  • Thân thiện SEO: mục lục có thể hiển thị trên kết quả tìm kiếm của Google.
  • Chèn bằng shortcode, Gutenberg block hoặc widget.
  • Button on toolbar of the classic editor.
  • Gutenberg block into “Common Blocks”.
  • Cài đặt số heading tối thiểu để hiển thị mục lục.
  • Cài đặt độ sâu heading cho mục lục.
  • Bỏ qua heading theo cấp độ hoặc văn bản.
  • Hierarchical or linear view.
  • Numeration items: decimal or roman numbers in order or nested.
  • Giao diện tùy chỉnh: rộng, float, cỡ chữ và độ đậm tiêu đề, cỡ chữ item, màu sắc.
  • Color scheme (tối, sáng, trắng, tróng uốt) và khả năng viết đè màu sắc.
  • Nút Hiển thị/Ẩn (tùy chọn)
  • Nhãn tùy chỉnh.
  • Cuộn mượt (tùy chọn).
  • Setting offset top for smooth scroll.
  • Bao mục lục với thẻ <!–noindex–> (tùy chọn)
  • Hash đẹp hơn trong đường dẫn (ví dụ example.com/faq/#how_do_this).
  • Hỗ trợ RTL
  • Available override global settings for a particular post.
  • Hoàn toàn tương thích với WordPress theme và plugin.

Tự động chèn

Để chèn tự động mục lục vào bài viết, chọn “Tự động chèn mục lục” trong phần cài đặt plugin (tab “Tự động chèn”).

Vị trí hỗ trợ:

  • trước heading đầu tiên:
  • sau heading đầu tiên:
  • after first block (paragraph or heading);
  • đầu bài viết;
  • cuối bài viết.

Bạn cũng có thể lựa chọn kiểu post type mà lục lục sẽ được thêm tự động.

Chèn thủ công

Để chèn thủ công một mục lục trong bài viết, hãy sử dụng một trong các cách sau:

  • nút “Mục lục” trên thanh công cụ trong trình chỉnh sửa cổ điển;
  • khối gutenberg “Mục lục”;
  • shortcode [lwptoc].

Hash đẹp trong URL

Mặc định, hash sẽ được tạo ra sau heading (ví dụ, #How_Do_This). Bạn có thể thay đổi định dạng has trong Cài đặt chung, tab “Khác.”.

Với web không phải Tiếng Anh bạn nên bật tiện ích Intl PHP.

Tương thích

LuckyWP Table of Contents đã thử thành công với các plugin sau:

Hooks

Filters lwptoc_before, lwptoc_after

Sử dụng để thêm HTML tùy chỉnh trước/sau mục lục.

Ví dụ:

add_filter('lwptoc_before', function ($before) {
    return '<p>Example text before TOC.</p>' . $before;
});

Filter lwptoc_shortcode_tag

Sử dụng filter này để đổi tên tag shortcode [lwptoc].

Ví dụ:

add_filter('lwptoc_shortcode_tag', function ($tag) {
    return 'toc';
});

Filter lwptoc_heading_id

Sử dụng để sửa ID heading.

Ví dụ:

add_filter('lwptoc_heading_id', function ($id, $label) {
    return $id;
}, 10, 2);

Ảnh màn hình

  • Mục lục
  • Hỗ trợ Gutenberg
  • Hỗ trợ Classic Editor
  • Tùy chỉnh cửa sổ
  • Examples of Color Solutions
  • Cài đặt widget
  • Cài đặt tổng quan
  • Cài đặt giao diện
  • Cài đặt tự động chèn
  • Xử lí cài đặt heading
  • Cài đặt linh tinh

Khối

Plugin này cung cấp 1 khối.

  • Luckywp Tableofcontents

Cài đặt

Cài đặt từ bảng tin WordPress

  1. Đi tới “Plugin > Cài mới”.
  2. Nhập “LuckyWP Table of Contents” trong ô tìm kiếm
  3. Tìm “LuckyWP Table of Contents” trong trang tìm kiếm và bấm vào “Cài đặt ngay”, quá trình cài đặt plugin sẽ bắt đầu.
  4. Bấm “Kích hoạt” khi cài đặt hoàn tất.

Cài đặt với tệp nén

  1. Đi tới “Plugin > Cài mới” ở bảng tin WordPress
  2. Bấm vào nút “Tải lên plugin”, form tải lên sẽ mở ra.
  3. Chọn tệp nén của plugin và bấm “Cài đặt ngay”.
  4. Bấm vào nút “Kích hoạt plugin” when cài đặt hoàn tất.

Cài đặt thủ công

  1. Tải thư mục luckywp-table-of-contents vào trong thư mục /wp-content/plugins/.
  2. Đi tới “Plugin > Cài mới” ở bảng tin WordPress
  3. Tìm “LuckyWP Table of Contents” trong danh sách plugin và bấm “Kích hoạt”.

Sau khi kích hoạt

Ở trình soạn thảo cổ điển sẽ xuất hiện nút “Table of Contents” (hoặc Mục lục khi sửa bài viết/trang).

Trong Gutenberg sẽ xuất hiện block “Table of Contents” (hoặc mục lục, xem ở “Block hay dùng”).

Menu “Mục lục” sẽ xuất hiện trong menu “Cài đặt” trong bảng tin WordPress.

Với web không phải Tiếng Anh bạn nên bật tiện ích Intl PHP.

Đánh giá

17 Tháng Một, 2025 2 trả lời
The plugin is not working. If it is not supposed to display (when there are no H2-H6 in the post), it starts showing content as the title from other posts.
3 Tháng mười một, 2024 1 trả lời
It´s good, easy functional. I´d like only some more functions for example the possibility to define the depht of a chapter without using h1, h2 etc.
30 Tháng mười, 2024 1 trả lời
I am very happy with the plugin, it is easy to use and does what it is supposed to do, it also offers many creative design options. A small difficulty initially arose when I tried to create a table of contents from already numbered headings, as the numbering appeared twice. This was easily solved by selecting the option ‘without enumeration’ in the plugin settings under General/Enumeration. Thank you very much!
28 Tháng mười, 2024 1 trả lời
This is a great plugin! Initially, I wasn’t sure about installing a plugin that automatically installs table of contents on every posts, instead of selected the posts I want to show the TOC on. After using it, I came to the conclusion that: 1/ It’s much better if you may uninstall the plugin, it won’t require removing code from posts; 2/ The options ensure you will make TOC available on posts that realy need it. It’s very well thought.
Đọc tất cả 830 đánh giá

Người đóng góp & Lập trình viên

“LuckyWP Table of Contents” là mã nguồn mở. Những người sau đã đóng góp vào plugin này.

Những người đóng góp

“LuckyWP Table of Contents” đã được dịch qua 32 ngôn ngữ. Cảm ơn những người tham gia dịch vì đóng góp của họ.

Dịch “LuckyWP Table of Contents” sang ngôn ngữ của bạn.

Muốn tham gia phát triển?

Duyệt code, check out SVN repository, hoặc theo dõi nhật ký phát triển qua RSS.

Nhật ký thay đổi

2.1.9 — 2024-11-08

  • Fix “LuckyWP Plugins” page.

2.1.8 — 2024-10-28

  • Adapt to WordPress 6.7.

2.1.7 — 2024-10-18

  • Fix non-critical vulnerability.

2.1.6 — 2024-10-04

  • Fix vulnerabilities.

2.1.5 — 2024-09-05

  • Minor refactoring.

2.1.4 — 2020-08-03

  • Minor refactoring.

2.1.3 — 2020-06-07

  • Added hook filter lwptoc_allow.

2.1.2 — 2020-05-08

  • Added hook filter lwptoc_title_tag.

2.1.1 — 2020-03-15

  • In heading ID duplicate hyphens are replaced with one.
  • Fixed: content of tags <style> and <script> was included in heading label.

2.1 — 2020-03-12

  • Added option “Additional CSS Class(es)”.
  • Added option “OL/LI” to “List Markup Tags”.
  • Added support Oxygen Builder.
  • Removed class “lwptoc_item” from links.
  • Minor fixes for performance.

2.0.9 — 2020-03-07

  • Added hook filters lwptoc_heading_html and lwptoc_heading_label.
  • Fixed: in some cases don’t register JS/CSS files.
  • Minor fixes for compatibility with future versions of WordPress.

2.0.8 — 2020-02-23

  • Added hook filter lwptoc_active.
  • Added tab “LuckyWP Plugins” to settings.
  • Improvement work option “Skip headings by text”.
  • Fixed: in some cases shortcode incorrectly processed.
  • Fixed: in some cases auto insert work incorrectly.
  • Fixed: headings in table of contents not escaping.
  • Minor fixes in customize window.

2.0.7 — 2020-01-31

  • Added support child themes of “Twenty Twenty”.
  • Fixed: incorrect smooth scroll behavior when on page use CSS html {scroll-behavior: smooth;}.
  • Fixed: in some cases auto insert after first block work incorrectly.

2.0.6 — 2020-01-29

  • When enabled smooth scroll hash changed after complete animation.
  • Fixed: incorrectly processing conditional comments in content.
  • Fixed: JS don’t work on asynchronous loading.

2.0.5 — 2020-01-26

  • Fixed: incorrectly processing HTML entities in links.
  • Fixed: incorrectly processing scripts, styles and CDATA in content.

2.0.4 — 2020-01-25

  • In debugging information for “Site Health” tool added “intl Version” and “ICU Version”.
  • From hash is removed colon symbol when used hash format “As heading without transliterate”.
  • Fixed: incorrectly processing HTML entities.

2.0.3 — 2020-01-19

  • Added support “Twenty Twenty” theme.
  • Minor code refactoring.

2.0.2 — 2020-01-10

  • Fixed: in some cases plugin incorrectly work with UTF-8.
  • Fixed: on automatically insertion table of contents with option “Before/after first heading” to posts without headings occurred error.
  • Fixed: if disabled show/hide toggle occured JS error.

2.0.1 — 2020-01-08

  • Fixed: in some cases headings processing incorrectly.

2.0 — 2020-01-07

  • Added debugging information for “Site Health” tool.
  • CSS and JS are included only when table of content is displayed.
  • Removed dependency to jQuery on frontend.
  • Redesigned automatic insertion of table of contents using the PHP extension DOM (Document Object Model).
  • Redesigned processing headings using the PHP extension DOM (Document Object Model).
  • Minor enhancements in CSS.

1.9.11 — 2019-11-18

  • Added hook filters lwptoc_force_wp_transliterate and lwptoc_transliterator.
  • Fixed: in some cases for table of contents used a non-current post.

1.9.10 — 2019-11-10

  • Fixed: in some cases hash for heading without transliteration was generated incorrectly.

1.9.9 — 2019-11-06

  • Sửa lỗi tương thích nhỏ với WPML

1.9.8 — 2019-10-23

  • Sửa lỗi tương thích nhỏ với WordPress 5.3.

1.9.7 — 2019-10-17

  • Đã sửa: trong vài trường hợp widget không hiển thị hợp lí.

1.9.6 — 2019-10-11

  • Cải thiện tương thích với theme và plugin.

1.9.5 — 2019-10-09

  • Cải thiện tương thích với theme và plugin.

1.9.4 — 2019-09-04

  • Cải thiện tương thích với theme và plugin.

1.9.3 — 2019-08-25

  • Đã thêm tương thích WPML.

1.9.2 — 2019-08-11

  • Đã thêm hỗ trợ plugin Elementor.

1.9.1 — 2019-08-04

  • Đã thêm hỗ trợ plugin Toolset Views.

1.9 — 2019-08-04

  • Đã thêm color sheme đặc biệt “Kế thừa từ giao diện”.
  • Đã thêm tùy chọn “Danh sách Markup Tag”.
  • Đã thêm hỗ trợ cho Add-On Beaver Builder Themer.
  • Implemented automatic removal of empty headings from table of contents.
  • Automatic insertion of table of contents “after first block” takes into account only paragraphs and headings.
  • Improved JS code to prevent reinitialization.
  • Thay đổi nhỏ trong các văn bản, sửa lỗi chính tả.
  • Đã thêm mẹo cho dịch giả trong code.

1.8 — 2019-07-29

  • Đã thêm tùy chọn “Sử dụng rel=”nofollow” cho liên kết”
  • Đã thêm tương thích với plugin Rank Math SEO
  • Tùy chọn “Tự động chèn Mục lục” bị tắt theo mặc định.
  • In notice “Rate the plugin” action “I’ve already rated the plugin” replaced to “Don’t show again”.
  • Đã thêm mẹo cho dịch giả trong code.

1.7 — 2019-07-18

  • Added option “Replace underscores (_) with dashes (-)” for hash.
  • Added option “Convert to lowercase” for hash.
  • Thay đổi nhỏ trong các chuỗi.
  • Đã thêm mẹo cho dịch giả trong code.
  • Đã sửa: trong một vài trường hợp, bỏ qua heading làm việc không đúng.

1.6.1 — 2019-07-14

  • For hash format added option “As heading w/o transliterate”.
  • Added hebrew translate, thanks to @cdk-comp and @0enaro.
  • Added spanish translate, thanks to @fernandot, @sanbec and @nobnob.
  • Improved generate hash with option “As heading”.

1.6 — 2019-07-13

  • Đã thêm hỗ trợ RTL
  • Thêm tùy chọn “Phía sau số”.
  • Đổi text domain thành “luckywp-table-of-contents”.
  • Cải thiện hỗ trợ plugin Beaver Builder.

1.5.7 — 2019-07-10

  • Improvement smooth scroll implementation for support lazy loading images in content.
  • Fix: in some cases, incorrectly worked smooth scroll to headings.

1.5.6 — 2019-07-06

  • Fix: in some cases, incorrectly worked option “Minimal Count of Headers”.

1.5.5 — 2019-07-06

  • Modified code for compatibility with Toolset Access plugin.

1.5.4 — 2019-06-29

  • Đã thêm hỗ trợ plugin Beaver Builder.
  • Sửa: trong vài trường hợp, xử lý heading không làm việc đúng.

1.5.3 — 2019-06-27

  • Fix: when auto insert TOC do not overrided settings “Wrap table of contents with <!–noindex–> tag” and “Skip headings”.
  • Sửa: trong vài trường hợp, tự động chèn sau block đầu tiên không hoạt động.

1.5.2 — 2019-06-17

  • Đã thêm hook filter lwptoc_heading_id.
  • Implemented classic behavior on click “Back” in browser.

1.5.1 — 2019-06-05

  • Sửa lỗi

1.5 — 2019-06-04

  • Cải thiện cho công cụ tìm kiếm (Google và khác).

1.4.1 — 2019-06-01

  • Sửa lỗi

1.4 — 2019-06-01

  • Đã thêm widget “Mục lục”.
  • Đã thêm hỗ trợ in mục lục qua do_shortcode('[lwptoc]').
  • Cải thiện tương thích với các theme.

1.3.1 — 2019-05-09

  • Sửa lỗi

1.3.0 — 2019-05-08

  • Bỏ qua heading theo cấp độ hoặc văn bản.

1.2.2 — 2019-04-24

  • Sửa lỗi

1.2.1 — 2019-04-24

  • Cải thiện tương thích với các theme.

1.2.0 — 2019-04-23

  • Đã thêm tùy chọn float: “Giữa” và “Phải mà không flow”.
  • Đã thêm cài đặt “Định dạng hash”.
  • In anchors instead “name” attribute used “id”.
  • Cải thiện nhỏ trong CSS để tương thích với các theme.

1.1.1 — 2019-04-15

  • Thẻ <noindex> thay thế thành <!–noindex–>.

1.1.0 — 2019-04-14

  • Đã thêm tùy chọn “Bao mục lục với thẻ <noindex>”.
  • Đã thêm hook filter lwptoc_before, lwptoc_after, lwptoc_shortcode_tag.
  • Fix: into Gutenberg editor in block “Classic editor” don’t loaded CSS for shortcode.

1.0.4 — 2019-11-18

  • Sửa lỗi

1.0.3 — 2019-11-17

  • Thay đổi nhỏ về giao diện
  • Sửa lỗi

1.0.2 — 2019-11-16

  • Sửa lỗi

1.0.1 — 2019-11-15

  • Sửa lỗi

1.0.0 — 2018-11-14

  • Phát hành lần đầu.