Jump to content

Help talk:Category

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

@Thinker78: I don't think that {{tlx|DEFAULTSORT}} is a useful addition here. DEFAULTSORT is a magic word, not a template. If you follow the link to Template:DEFAULTSORT, the first thing you see is a box telling you not to use the template. -- John of Reading (talk) 06:39, 7 September 2023 (UTC)[reply]

@John of Reading I think you are mistaken. I infer the box you are talking about is the following,
Said box is not "telling you not to use the template". It is actually giving you guidance about its use. Regards, Thinker78 (talk) 06:55, 7 September 2023 (UTC)[reply]
Just because something has braces, does not make it a template.
See also: mw:Help:Magic words. - jc37 08:14, 7 September 2023 (UTC)[reply]
Right, {{DEFAULTSORT:Sortkey}} is not a template call but a builtin MediaWiki feature and it seems confusing to link Template:DEFAULTSORT. We don't want the template to be used and it currently has zero uses.[1] I have removed the link but changed {{DEFAULTSORT}} to {{DEFAULTSORT:}} to show the colon right away.[2] If you write {{DEFAULTSORT}} alone in wikitext (which would be pointless) then it actually calls the template and would produce a red template link if there was no template. The colon is needed to get the magic word. PrimeHunter (talk) 00:00, 8 September 2023 (UTC)[reply]
Well, if the guideline is telling people to use {{DEFAULTSORT}} and guidance to such use is in the page TEMPLATE:DEFAULTSORT, I don't see how removing such link is helping. I mean there is some contradiction here going on. From the template's documentation, "{{DEFAULTSORT:<sort key>}} is a magic word used to modify the sequence of pages shown on category pages." The page goes on to talk about the magic word and how to use the wikitext. It appears that it may not be a template but for convenience was placed in template namespace. Regards, Thinker78 (talk) 04:04, 8 September 2023 (UTC)[reply]
Pinging @SMcCandlish: (a template editor). Thinker78 (talk) 04:06, 8 September 2023 (UTC)[reply]
Okay, I'm here, but I'm not sure what if anything I'm being asked to do. :-) Skimming the above, I agree that the {{DEFAULTSORT}} template is deprecated in favor of the {{DEFAULTSORT:}} magicword, which looks similar to a template. But I'm not sure that my saying that is particularly helpful.  — SMcCandlish ¢ 😼  06:42, 8 September 2023 (UTC)[reply]

TEMPLATE:DEFAULTSORT might be added to the See also list at Help:Category#Default sort key but your edit was confusing. It said:

It is possible to set a default sort key which is different from {{PAGENAME}} by using the magic word {{DEFAULTSORT}}:

{{DEFAULTSORT:new key}}

But {{DEFAULTSORT}} is not the magic word, it's a template we don't want anyone to use. We only created that template to help users who accidentally write {{DEFAULTSORT|new key}} instead of the correct {{DEFAULTSORT:new key}}. Without the template, {{DEFAULTSORT|new key}} would make a red link to a non-existing template and no defaultsort would be applied to the page. It would be hard for many users to see why it went wrong. The example on the following correctly uses the magic word and not the template you want to link in the exact place we tell users to use the magic word. PrimeHunter (talk) 10:54, 8 September 2023 (UTC)[reply]

What about adding the wikilink to the text in this manner, "{{DEFAULTSORT:}}"? Regards, Thinker78 (talk) 03:44, 9 September 2023 (UTC)[reply]
Because that links to the template, which is precisely what we don't want. I have refined the link to take people to the most relevant section. --Redrose64 🌹 (talk) 15:03, 9 September 2023 (UTC)[reply]
Thanks for taking the time to refine the link Redrose64. I am still puzzled why the opposition to the DEFAULTSORT link in this thread though, as it gives guidance mostly about the magic word. Regards, Thinker78 (talk) 19:55, 9 September 2023 (UTC)[reply]
Linking to the magic word gives more information about the magic word, should someone want to know more about it. Linking to {{DEFAULTSORT}}, which also gives more information about the magic word (but importantly, is not the magic word that looks identical to it), is unnecessary because it requires an editor to go an extra click to get the same information and can potentially cause more confusion if they use the template and not the magic word. Primefac (talk) 20:04, 9 September 2023 (UTC)[reply]
@Thinker78: have you looked at the source for that template? It uses the magic word and adds the page to Category:Pages which use a template in place of a magic word, a maintenance category for pages that mistype magic words as templates. The template has well-written documentation but is something designed to fix a typo, and so by linking to it, we could confuse a new editor into adding typos to the articles. Rjjiii(talk) 21:51, 9 September 2023 (UTC)[reply]
I don't know how we could confuse editors into typos by leading them to the specific DEFAULTSORT documentation because it precisely states how it should be used and emphasizes how not to use it. Sorry, I am confused. To me the opposed link has cleared confusion in the past. Therefore I am really lost into the rationale of the consensus in this thread. Maybe I am trying to see things from a perspective of someone who donn't know how to use DEFAULTSORT?
"Help:Magic words#Behavior switches" only provides a passing mention of DEFAULTSORT, with a one-line sentence.
I remember going to lengths trying to figure out what was a sort key. To me the DEFAULTSORT link seems so much more useful. I don't know what I am missing. Sorry. Regards, Thinker78 (talk) 23:33, 9 September 2023 (UTC)[reply]
@Stemonitis: Thinker78 (talk) 23:41, 9 September 2023 (UTC)[reply]
If I could take a step back - we're talking about Help:Category § Default sort key, yes? Doesn't that section pretty much say what the template documentation says? If it doesn't, should we consider expanding that section? I think I can see where you're coming from but if we can improve the primary place someone would be looking for this information, that would probably the most helpful option. Primefac (talk) 06:06, 10 September 2023 (UTC)[reply]
  • "we're talking about Help:Category § Default sort key, yes?" Yes.
  • Doesn't that section pretty much say what the template documentation says? Pretty much, yes. Not all though.
  • If it doesn't, should we consider expanding that section? Absolutely. For example, magic word is linked but per MOS:NOFORCELINK "Do not unnecessarily make a reader chase links: if a highly technical term can be simply explained with very few words, do so."
Regards, Thinker78 (talk) 19:21, 10 September 2023 (UTC)[reply]
Let's put this another way - First, putting wiki syntax in the middle of a "nowiki" example is counter productive.
Second, linking to something that only exists to prevent misunderstanding and mis-use, is also counter productive.
the template exists exactly because some people misunderstand what a magic word is. Just as you did initially in this discussion. It exists to inform the editor that they made a mistake. If they see it, they made a mistake that needs fixing. It's never to intentionally be used - especially not in an example where we're trying to show users what to properly do. - jc37 23:17, 10 September 2023 (UTC)[reply]
Ok, therefore I think Primefac's questions are relevant in seeking a compromise. Regards, Thinker78 (talk) 00:55, 11 September 2023 (UTC)[reply]
Oh, if you are willing to add in the missing content on the help page, I think that's excellent and have no issues. The template docs are all made under the same license as any page, so you can even copy text directly and put something like "(Copied from [[:Template:DEFAULTSORT/doc]]) in the edit summaries for attribution. Good luck! Rjjiii(talk) 03:40, 11 September 2023 (UTC)[reply]

Explicit DEFAULTSORT same as page-title

[edit]

Is there any technical effect of doing {{DEFAULTSORT:Foo}} on page "Foo"? If not, is there any value to having it (other parsers, bots, etc.)? DMacks (talk) 09:52, 11 January 2024 (UTC)[reply]

@DMacks: I don't know of any present-day reason. I can think of two reasons that applied in the past, but which no longer apply:
  • Pages not in mainspace would at one time be sorted by their namespace, i.e. Help:Category would be sorted under H and not C - nowadays the namespace is ignored so it sorts as "Category".
  • Sortkeys were at one time case-sensitive, moreover, "a" sorted after "Z", so an article like Rock parrot would have {{DEFAULTSORT:Rock Parrot}} - now, "p" sorts with "P"
Which pages did you have in mind? Do they fit either of the above situations? --Redrose64 🌹 (talk) 19:13, 11 January 2024 (UTC)[reply]
Thanks for the explanation! I saw an edit on my watchlist where an explicit DEFAULTSORT that did not match the title was changed to match the title. Can't find it now. But I'm generally interested in sorting in the field of molecular formulas, where we want a category to sort:
Thanks to the newish 'numbersort' feature (rather than strict string sorting), H10 comes after H8. But we want an implicit "1" after certain letter strings. Easy enough to write a template that would emit 'DEFAULTSORT:C1H4' on the CH4 page. But then I was wondering if there were any side effects of having that template on every page (not just the ones that needed it), so 'DEFAULTSORT:C5H8' on the C5H8 page. DMacks (talk) 20:01, 11 January 2024 (UTC)[reply]
You should only need to do this on those pages that would otherwise sort in the wrong order. --Redrose64 🌹 (talk) 21:35, 11 January 2024 (UTC)[reply]
If a page has multiple DEFAULTSORT after all transclusions are performed then only the last is used. Sometimes a DEFAULTSORT is added unintentionally by a template. If a page has DEFAULTSORT and is moved without updating DEFAULTSORT then it may sort inappropriately. It may confuse editors if such a DEFAULTSORT is transcluded from a template. If your intended template works automatically from the page name then I guess this will not be an issue. PrimeHunter (talk) 00:43, 12 January 2024 (UTC)[reply]
Right. I occasionally work on resolving Category:Pages with DEFAULTSORT conflicts. Yet another reason to avoid needlessly asserting the default value explicitly. My intended use is a pile of setindex articles (as part of the {{Molecular formula index}} footer template) and redirects (as part of {{R from molecular formula}} tag). In both cases, the use is limited to molecular-formula pages, to enable proper sorting by molecular formula. DMacks (talk) 01:05, 12 January 2024 (UTC)[reply]
If there are two or more DEFAULTSORT with different values, it does use the one that is last in the page code after template expansion, but it also throws an error, see sandbox. --Redrose64 🌹 (talk) 18:24, 12 January 2024 (UTC)[reply]
An error can be suppressed with |noerror. Replacement of an earlier DEFAULTSORT can be avoided with |noreplace. PrimeHunter (talk) 13:47, 13 January 2024 (UTC)[reply]

DEFAULTSORT needs a new name

[edit]

Don't share my information

[edit]

Don't share my device information and my personal Gmail password and my and thard party user tha last off my device pleass 2A02:CB80:425E:9040:F162:145A:3371:7429 (talk) 01:29, 8 October 2025 (UTC)[reply]

The Wikimedia Foundation, which operates this Wikipedia website, does not collect much personal information and does not share it. See the privacy policy. -- John of Reading (talk) 06:52, 8 October 2025 (UTC)[reply]

Help editing categories

[edit]

John of Reading Greetings and sorry to disturb you, but you are the last person to have contributed to this talk page. I have just found out that some categories look like templates, which I try to edit them and I can't figure out how to do the editing. For example, when I open Category:19th-century Bulgarian historians the editor does not display its subcategories but instead there appears {{Historians by nationality and century category header}}. I would highly appreciate any help as to how I may edit such categories/templates. Best regards, --Gligan1 (talk) 12:06, 19 January 2026 (UTC)[reply]

@Gligan1: When you view a category, the software shows you the contents of the category page itself, and then the list of sub-categories, if there are any, and then the list of pages in the category. Thus the contents of the category page only acts as the header for the system-generated lists. At Category:19th-century Bulgarian historians, you're seeing the call to the header template, which creates the little box beginning "14th 15th..." and the next box beginning "Portals:".
What edit are you trying to make? -- John of Reading (talk) 12:33, 19 January 2026 (UTC)[reply]
@John of Reading:Thank you very much for the quick response. I would like to remove "Category:19th-century scientists from the Ottoman Empire" and add instead "Category:19th-century historians by nationality" as per the same logic as Lithianian, Latvian, Nigerian, Czech, Polish, Ukrainian, Belarusian, Serbian, Romanians, Indian, etc. historians - all of these countries either did not exist as entities in the 19th century, or were part of the Russian, Ottoman, British, Austro-Hungarian and other empires, just as Bulgaria. It makes no sense (and is rather insulting) for the Bulgarians to a sub-category of "Historians from the Ottoman Empire", while all those nationalities are in main categories of their own. I would like to do the same to all other occupation categories, there the Bulgarians are presented "...from the Ottoman Empire", such as scientists, educators, clergy, etc. Best regards, --Gligan1 (talk) 12:49, 19 January 2026 (UTC)[reply]
@Gligan1: That template's coding looks very complex! I suggest you post at Template talk:Occupation by nationality and century category header. With luck, you'll get an answer from someone who is familiar with the template and its sub-templates. -- John of Reading (talk) 13:01, 19 January 2026 (UTC)[reply]
Thank you very much for the advice, I have asked for help at the template talk page. Kind regards, --Gligan1 (talk) 13:12, 19 January 2026 (UTC)[reply]