วิธีใช้:หมวดหมู่

This page is a translated version of the page Help:Categories and the translation is 47% complete.
PD หมายเหตุ: เมื่อคุณแก้ไขหน้านี้ ถือว่าคุณยินยอมที่จะเผยแพร่งานของคุณภายใต้สัญญาอนุญาต CC0 ดูที่หน้าช่วยเหลือกรณีสาธารณสมบัติ สำหรับข้อมูลเพิ่มเติม PD

หมวดหมู่ ซึ่งเป็นคุณลักษณะซอฟต์แวร์หนึ่งของมีเดียวิกิ จัดเตรียมดัชนีอัตโนมัติที่มีประโยชน์เหมือนกับสารบัญของเนื้อหา

คุณสามารถทำหน้าจัดหมวดหมู่และไฟล์โดยเพิ่มหนึ่งหรือมากกว่าหนึ่งแท็กหมวดหมู่ ให้กับข้อความเนื้อหา แท็กเหล่านี้สร้างการเชื่อมโยงที่ด้านล่างของหน้าเว็บ โดยจะนำคุณไปยังรายการของทุกหน้าในหมวดหมู่ดังกล่าว ซึ่งทำให้ง่ายต่อการเรียกดูบทความที่เกี่ยวข้อง

สรุป

ในแต่ละหน้าในเนมสเปซหมวดหมู่ ได้แสดงให้เห็นถึงสิ่งที่เรียกว่า หมวดหมู่ ซึ่งการเป็นจัดกลุ่มของหน้าที่เกี่ยวข้อง และมีดัชนีหน้าของหมวดหมู่นั้น ๆ ตัวอย่างเช่น หน้านี้เป็น "หมวดหมู่:ช่วยเหลือ " หากคุณเปิดหน้าหมวดหมู่ คุณจะเห็นลิงก์ไปยังหน้าดังกล่าว

เมื่อหน้ามีหนึ่งหมวดหมู่หรือมากกว่า หมวดหมู่เหล่านี้ปรากฏที่ด้านล่างของหน้า (หรือในมุมขวาบน ขึ้นอยู่กับสกินที่นำมาใช้)

หน้าหมวดหมู่ของตัวมันเองประกอบด้วย 2 ส่วน:

  • ที่จุดเริ่มต้นเหล่านั้น เป็นส่วนหนึ่งที่ให้เลือกได้โดยเป็นข้อความที่สามารถแก้ไขได้ เช่นเดียวกับหน้าอื่น ๆ
  • ในตอนท้ายเหล่านั้น ที่เคยนำเสนอ จะสร้างโดยอัตโนมัติ โดยเป็นรายชื่อเรียงตามตัวอักษรทุกหน้าในหมวดหมู่นั้นในรูปแบบของลิงก์ แท้ที่จริง เป็นการจัดเรียงประเภทของยูนิโคด

ในการกำหนดหมวดหมู่ไปยังหน้า เพียงแค่เพิ่มลิงก์ "[[หมวดหมู่:ชื่อหมวดหมู่]]" สำหรับข้อความวิกิของหน้าเว็บ โดยตามปกติจะเพิ่มอยู่ที่ด้านล่างของหน้า

ลิงก์หน้าหมวดหมู่ภายในหน้าเว็บเป็นลิงก์ของวิกิปกติ (โดยไม่ต้องเพิ่มหน้าไปยังหมวดหมู่) โดยเติมชื่อลิงก์กับเครื่องหมายมหัพภาคคู่ ตัวอย่างเช่น: [[:หมวดหมู่:ไม่ได้อยู่ในหมวดหมู่นี้]]

หมวดหมู่ใหม่สามารถสร้างก่อนที่จะกำหนดหน้าเว็บใด ๆ สำหรับมัน ในลักษณะเดียวกับหน้าปกติอื่น ๆ

แต่ละวิกิอาจมีประเภทระดับสูงสุดของตัวเอง เช่น หมวดหมู่:หมวดหมู่ ในวิกิพีเดีย

สำหรับรายการที่สมบูรณ์ของทุกหมวดหมู่ซึ่งมีอย่างน้อยหนึ่งหน้า ให้ดูที่ หน้าพิเศษ:หมวดหมู่

สำหรับรายการที่สมบูรณ์ของการสร้าง/แก้ไขหมวดหมู่ทั้งหมด รวมทั้งที่ไม่ได้มีหน้าใด ๆ ให้ดูที่ Special:Allpages/Category: (ใช้เครื่องหมายมหัพภาคคู่เมื่อสิ้นสุด)

การเพิ่มหน้าไปยังหมวดหมู่

หากต้องการเพิ่มหน้าหรือไฟล์อัปโหลดไปยังหมวดหมู่ เพียงแค่แก้ไขหน้าและเพิ่มข้อความต่อไปนี้ (ที่ ชื่อ เป็นชื่อของหมวดหมู่ที่คุณต้องการเพิ่มเข้าไป)

[[Category:ชื่อ]]

หมายเลขใด ๆ ของแท็ก Category อาจจะเพิ่มหน้าและหน้าจะมีการระบุไว้ทั้งหมด แท็ก Category พร้อมกับลิงก์ข้ามภาษา ที่วางไว้ในแถบด้านข้าง มักจะมีการเพิ่มที่ด้านล่างสุดของหน้าเพื่อความสะดวกของผู้แก้ไขอื่น ๆ

ในหน้าหมวดหมู่ หมวดหมู่จะแสดงในหมวดหมู่: ล้อมกรอบอย่างถูกต้องตามลำดับที่ปรากฏในข้อความวิกิ

หากกำหนด $wgUseCategoryBrowser ให้ถูกต้อง ภายใต้รายการแรกแต่ละหมวดหมู่จะทำรายการอีกครั้ง รูปแบบเครื่องมือที่ใช้นำทางในเว็บ กับหมวดหมู่หลักของมัน เรียงตามตัวอักษร (อย่างน้อยในมีเดียวิกิ 1.18.2) หากหมวดหมู่เป็นหมวดหมู่ย่อยมากกว่าหนึ่งหมวดหมู่หลัก ทั้งลำดับชั้นจะได้รับการทำเป็นรายการ แต่หมวดหมู่ที่ได้รับการติดป้ายจะเปลือยเปล่าทั้งหมดเว้นแต่หนึ่งในจำนวนนี้ การสร้างที่อาจเกิดขึ้นนี้ สำหรับสิ่งที่ดูเหมือนจะเป็นรายการที่ซ้ำกันหากหมวดหมู่ที่มีหลายหลัก และ หนึ่งในหลักเหล่านี้ทั้งคู่จะได้รับการติดป้ายบนหน้า ตัวอย่างเช่น สมมติว่า แมรีแอนน์ เป็นหมวดหมู่ย่อยของทั้ง แมรี และ แอนน์ หากมีป้ายหน้าหมวดหมู่แมรีแอนน์ และแอนน์แล้ว เครื่องมือที่ใช้นำทางในเว็บหมวดหมู่ก็จะแสดง

Anne 
Anne
Mary -> Maryanne

"แอนน์" ดูเหมือนจะซ้ำ แต่ก็เป็นสิ่งที่มีควาหมาย

Anne 
Anne -> Maryanne
Mary -> Maryanne

นี่คือข้อผิดพลาด และได้รับการรายงานในphab:T35614

แก่นสารหมวดหมู่

โดยค่าเริ่มต้น หน้าจะได้รับการจัดเรียงภายในหมวดหมู่ภายใต้ตัวอักษรตัวแรกของชื่อ — โดยปราศจากเนมสเปซ นอกจากนี้ มีเดียวิกิได้จัดกลุ่มอักขระเน้นเสียงแยกต่างหากจากเวอร์ชันที่ไม่มีการเน้นเสียง ดังนั้นหน้าเว็บที่เริ่มต้นด้วยตัวอักษร Á, Á, Ä จะได้รับการระบุไว้ภายใต้หัวเรื่องแยก แทนที่จะอยู่ภายใต้หัวเรื่องอักษร A (หากคุณมีสิทธิ์เข้าถึงเชลล์ ค่าเริ่มต้นเหล่านี้สามารถเปลี่ยนแปลงได้โดยใช้ $wgCategoryCollation )

A sort key specifies under which letter heading, and where in the category list, the page will appear. You can add a sort key by placing it inside the tag after a pipe character. For example, the tag below will add the page under heading "S".

[[Category:ชื่อ|เรียงลำดับ]]

Whether or not sort keys are case-sensitive depends on your configuration settings. The order of the sections within a category follows the Unicode sort order. The sort key does not change the page title displayed in the category.

Spaces and other characters are perfectly valid.

See Help:Sorting for further information on category sorting.

การสร้างหน้าหมวดหมู่

Categories exist even if their page has not been created, but these categories are isolated from others and serve little purpose for organisation or navigation.

A category is created by creating a page in the Category: namespace. A category page can be created the same way as other wiki pages (see วิธีใช้:การสร้างหน้าใหม่ ); just add "Category:" before the page title.

To avoid extra work, try searching within your wiki before creating a new category. The list of all categories can be found in "หน้าพิเศษ" in the "เครื่องมือ" box of the sidebar.

Managing the category hierarchy

Categories may belong to other categories in a hierarchy. Since category pages are much like any other page, a Category tag may be added to the bottom of a category page.

It is a good idea to organise all categories into a hierarchy with a single top level category. The category structure can take the form of a tree with separate branches, but more often will have a graph structure. Generally, there should be a contiguous chain of parent-child links between each category and the top level category.

Category tree

Since MediaWiki 1.31, CategoryTree extension is packaged by default, allowing Special:CategoryTree and ‎<categorytree> to provide a tree-like structure display for the categories.

Hidden categories

The categories that a page is in are normally listed at the bottom of the page. In MediaWiki 1.13+, a category can be hidden from this list by adding the magic word "__HIDDENCAT__" to the category page.

Users can choose to see hidden categories in a separate "หมวดหมู่ที่ซ่อนอยู่" list, by checking "แสดงหมวดหมู่ซ่อน" in the "การแสดงผล" section of Special:Preferences.

Hidden categories are automatically added to Category:Hidden categories. This category is specified in the system message MediaWiki:Hidden-category-category.

Linking to a category

To create a link to a category, use a leading colon before the category name (without this colon, the current page would be added to the category):

[[:Category:Help]]Category:Help

To change the link text, write the text inside the link tag after a pipe:

[[:Category:Help|Help category]]Help category

Redirect pages that redirect to categories must also use the colon, otherwise they will be added to the category instead of redirecting.

Categories and templates (transcluded pages)

If you add [[Category:Cats]] inside a template (a transcluded page), both the template and pages which transclude this template will be categorised as Cats.

  • If you want only the template to be categorised, you should ensure to write category marker inside <noinclude> tags.
  • If you want only the pages which uses the template to be categorised, but not the template itself, you should ensure to write category marker inside <includeonly> tags.

Due to caching issues, editing categories applied through templates may take a while to be visible everywhere. You can perform a null edit on a page to update immediately its categories.

Redirecting a category

Like normal wiki pages, category pages can be redirected to other normal or category pages. However, this is not recommended, as pages categorised in redirected categories do not get categorised in the target category (phab:T5311). Some Wikimedia sites use a "category redirect" template to mark redirected categories, allowing manual or automated cleanup of pages categorised there.

Tracking categories

Certain syntax issues, such as a broken image link, or too many expensive parser functions, can cause a page to be added to a tracking category. See Help:Tracking categories for details.

Renaming a category

If you move a category, since redirect will not work for categorising, all category tags will be wrong, so you have to fix them.

ดูเพิ่ม