Bản mẫu:CatAutoTOC

Bách khoa toàn thư mở Wikipedia
Tài liệu bản mẫu[xem] [sửa] [lịch sử] [làm mới]

Thêm mục lục thể loại tùy theo số lượng trang nằm trong thể loại đó.

Các ngưỡng kích thước là:

  1. <= 100 trang → không TOC
  2. 101–1200 trang → {{Category TOC}}
  3. > 1200 trang → {{Large category TOC}}

Cách sử dụng[sửa mã nguồn]

{{CatAutoTOC}}

On category pages, {{CatAutoTOC}} can be placed wherever you want the TOC to be displayed.

On a category header template, it is best placed outside any <includeonly></includeonly> tags, so that the template is categorised as using CatAutoTOC.

Tham số[sửa mã nguồn]

Không tham số cần thiết.

However, the parameters available {{Category TOC}} may be supplied, and if CatAutoTOC calls {{Category TOC}}, those parameters will be passed on to {{Category TOC}}.

So e.g. {{CatAutoTOC|align=center}} will:

  1. Have no effect if no TOC is generated
  2. Align to the center if {{Category TOC}} is used
  3. Have no effect if {{Large category TOC}} is used, because {{Large category TOC}} accepts no parameters

Theo dõi[sửa mã nguồn]

Hiệu ứng CatAutoToc Các trang %
Không có TOC 31.287 97,87%
{{Mục lục thể loại}} tiêu chuẩn 605 1,89%
{{Mục lục thể loại lớn}} 76 0,24%
Tổng số 31.968
Làm tươi trang này để cập nhật tổng số.

Each page using this template is categorised in one of three tracking categories:

Templates which transclude {{CatAutoTOC}} are categorised in

... but only if the transclusion is outside any <noinclude></noinclude> tags

Purge this page to update the totals

Lỗi[sửa mã nguồn]

This template uses the magic word {{PAGESINCATEGORY}} to count the number of pages in the category. Unfortunately, this function can return wildly erroneous results on some categories which have had many pages added and removed.

Lỗi này nổi tiếng thường gặp và đã được ghi lại ở một số nơi kể từ năm 2010, bao gồm:

In the overwhelming majority of categories, the count is recorded accurately enough to support use of this template. However, there seemed to be some issue with {{PAGESINCATEGORY}} falsely returning zero in some cases. This is tracked in:

As of 19 April 2020, that problem seems to have been fixed by a small but cunning tweak[1] to how {{PAGESINCATEGORY}} is called.

The category should contain only pages labelled as "empty". Purge page to update totals

Xem thêm[sửa mã nguồn]