Forum:Temlate Documentation in Categories but unwanted

Argh, this is driving me insane! I've created templates which (amongst other things) add the page that uses the templates to a Category. Fine. I've even almost managed to slightly get my head around noinclude, includeonly and onlyinclude!!

So in the template itself (eg: w:c:ParadiseIslandHD:Template:Size) I have:

x tiles 

Which both creates a Link to the Category and adds the page to the category.

At first, I suddenly had these new templates turning up in the Categories themselves so I learnt to wrap the Category inside of includeonly, which I understand makes the template page not appear in the category, but the page that calls it will - perfect.

So next step was to add /doc documentation pages. Following the documentation guidelines I dutifully created (eg: w:c:ParadiseIslandHD:Template:Size/doc) with the content as specified:

;Description :This template takes a single-digit integer and outputs the Size text and adds the page to the relevant Size Category. :It can be used stand-alone or it is called from the NewStructure Template ;Syntax :Type  somewhere. ;Sample output : gives... : And I understand the includeonly - Category-Infobox templates puts the template that it references (BASEPAGENAME) into that category and puts itself into the Documentation Category, although why the policy is to do it that way and not to simply put the Category-Infobox templates on the BASEPAGENAME itself with NO noinclude, NO includeonly and NO onlyinclude around it, I don't understand as it would seemingly put the template page itself directly into it's Template Category.

But the actual issue I have - is after dutifully creating this documentation page, using the example parameter "5", because the Size/doc is calling Size, it is adding the Size/doc subpage to the 5x5 Category!!! It is beyond me how wikitext is full of these confusing include/only/no Magic Words, especially combined with documentation, specifically using the documentation include code to put the template into a template category, keeping the template page itself out of the category and then the Template:Documentation code following the wikitext guidelines screws it all up by putting the tamplate/doc subpage into the category!!!

As far as I can tell - any and every single Template page that inserts the page-that-uses-the-template into a Category that also uses with a /doc subpage that uses the default example code screws it up, so we just can't document properly templates that add pages to categories...?


 * Actually, BOTH Template:Size and Template:Size/doc pages are now in the w:c:ParadiseIslandHD:Category:5x5?sort=recentedits&display=exhibition Category! And that's just one of the many templates I've set up for different categories. I've spent the whole night every night this past week trying to get this stuff working and it's sunrise again now. I just want to get this done and go to sleep but there's a dozen new pages to be created in only a few days and I really wanted to get my w:c:ParadiseIslandHD:Template:NewStructure Preloaded template working :-(

Simple solution, delete this line: gives... : --That line is making the template get categorized.

More complicated solutions include detecting what page is translcuding the template, or adding a demo=yes parameter.

If this is only to use used on filepages, you can even make it so the template only works in filespace.

70.49.127.65 04:47, July 1, 2012 (UTC)
 * Indeed, here's how: -452  15:14, October 30, 2012 (UTC)
 * Another workaround I've found involves putting 452's basic coding (with a significant change) into an easy-to-use template —  .  Any time I have a template that auto-populates a category, I simply add  to the template.  This forces the template to only add categories if they're not in the template namespace.


 * In other words, 452's solution only adds categories to pages in ns:0.    does the opposite, and prevents the category from being added to ns:10, the template namespace.  That way, you can use  even when your template applies to ns:2, ns:8, ns:110, ns:whatever.  The only case where it doesn't work is with ns:10.  That makes it much more flexible.  Unless you have a specific reason to prevent a template that is being used in the file namespace or the forum namespace or the help namespace — or wherever — to not be auto-included in the category the template specifies, it's certainly better to exclude ns:10 rather than to only include ns:0.    16:00: Tue 30 Oct 2012