This is a talk page for improving Categories.

[!Categories] Page-sections as categories

Is it already possible to link from anchors in a page (as a page section, defined by anchor) to Categories for that category list to include not only pages but also page sections?

If not, could it be an improvement?

Pierre Rousseau January 03, 2022, at 03:36 PM

The category link can be placed in a page section, but the whole page becomes attached to the category, not just the section. I think if you place the category link in a heading, and enable Table of contents, people coming from the category page will easily notice the section. See how I "tagged" your section heading above. --Petko January 03, 2022, at 04:33 PM

Listing a page's categories

Is it possible to list a page's categories using a Page List? e.g. A list of pages with the categories, or a list of pages without categories?

The are clearly captured in the page data file


Perhaps they can be exposed as a page variable that can be iterated through, or displaced as a string (e.g. "Jam Feijoa")

simon April 12, 2020, at 11:14 PM
Yes, you can do it using PageListMultiTargets. Finar April 20, 2020, at 03:50 PM

Is it possible to autocreate cats from PTV's?

ex: i make some PTVs on pages, then add some conditional markup in GroupFooter to make cats on all pages simultaneously, but since they are not held in page text, cat listing are not working. to make em work, i need such markup in every page text.

What's the best way to do something like that w/o requiring markup on every page?


What is 'text' (used) for?

$AutoCreate['/^Category\./'] = array('ctime' => $Now, 'text' => $page['text']);

Such a line of code is probably wrong in config.php, where $page['text'] is undefined. The 'text' entry is the wikitext of the newly created page, can be "" (empty) or, for example "List of pages linking to {\$Title}" or 'List of pages linking to {$Title}' (backslash needed to escape the $Title variable in double quotes, not in single quotes). See PageFileFormat. --Petko January 17, 2018, at 08:31 AM

For "Catergories Just Don't Work"!

If you are driving yourself crazy trying to introduce Categories on an existing site, try deleting wiki.d/.pageindex . This wiil do no harm; the index will be regenerated. This also may help other apparently inexplicable failures. .pageindex can get out of sync from a variety of situations from klutzy admin to filesystem disaster.

Note: If the .pageindex file is a recurring source of trouble for you, you can get rid of it permanently without harm (as far as I can tell) using .htaccess. Just use the FilesMatch markup and refer to the file as pageindex, .pageindex pageindex.flat or anything else that might cause a match. I'm not a programmer; just trying to be helpful.

Using the Auto Created Pages

If you enable the auto creation of the category pages you can use them to display links to pages which belong to that category.

Add these two lines to your local config.php.

$page = ReadPage('Category.GroupTemplate', READPAGE_CURRENT);
$AutoCreate['/^Category\\./'] = array('ctime' => $Now, 'text' => $page['text']);

Then navigate to the Category.GroupTemplate page (which will create a new page) and edit that page to include:

(:pagelist link=Category.{*$Name} list=normal:)

Every time a category page is autocreated it will have the content you placed in the GroupTemplate. Each category page will display a linked list of pages in that category. This places the list in the body of the page rather than in the footer.

This should not be required, if one creates the Category.GroupFooter, as explained in the page. --Petko February 14, 2009, at 08:11 AM

Q: Is there any way to take tag name to AutoCreate's 'text' field so in the end I can have page Category.AlternativeWorld with title "Alternative world" (as it's written in the tag, second word's first letter is small as opposed to $Titlespaced) for example?

Distinguishing between defining and referencing a category

Unfortunately PmWiki cannot distinguish between defining a category (or tagging a page)[1] [2], normally done like this


and referring to a category, via

[[Category/!Links?action=browse|$[Links-langvar]] this markup (Links langSpez-Var) can be used to tag a category, and refer it, and also translate the link. PatrickOgay

One workaround is to create an InterMap entry that maps "Category:" to the Category page group, and then refer to category TalkPage as Category:TalkPage, while continuing to tag pages that belong to category TalkPage in the usual way. The disadvantage is that the InterMap link will be treated as an external link, and thus not discovered when searching for backlinks. also possible: [[Category/Links?action=browse|+]] -> Links

See Also: Wikipedia:Use80%93mention_distinction

Invisible category links

  • Invisible category links are possible, use %comment% [[!SomeCategory]]
  • Administrators can create a %category% style to control whether or not to display category links: either %define=category comment% or else $WikiStyle['category']['display'] = 'none';

How to list categories used on any given page

  • In order to list the categories of a given page (or even a list of pages), a PageVariable can be set in config.php
$FmtPV['$Links'] = '@$page["targets"]';
and then used in the pagelist name= parameter.

There is a mailing list thread where this matter is better explained and referenced.

How to have a pseudo-tag cloud powered by categories

I've used core PmWiki functions to have a sort of tag cloud that is suitable for the Site.SideBar or Group.GroupFooter pages. The page list format that I used will cause the categories list to fit very well into a narrow column or a wide page area. Below are the steps I took to achieve this:

Step 1:
I used a custom page list format to lay out the categories list into paragraph form. Add this custom page list format to your Site.LocalTemplates page:


(:template defaults order=title:)

Step 2:
Now we can use this custom page list format in our categories page list. Add this markup to the page that holds your categories list:

(:pagelist group=Category list=normal fmt=#categoryspaced:)

That's it! An example of this setup can be seen on my Categories page. IanMacGregor October 19, 2013

- Is it possible, somehow, to merge two (or more) categories, after they have been created?
For example. I have a category named "Thriller", and a category named "Comedy".
Can I create a new category named "Movies", that will automatically list all pages in "Thriller" and "Comedy",
without having to write [[!Movies]], in every single of those pages?
Of course, I can place [[!Movies]] in these two categories,
but that would just list "Category.Thriller" and "Category.Comedy" links.
Likewise, a redirect link won't do...

This is a talk page for improving PmWiki.Categories.