Posted by Phil Chett on 29 May 2007 14:42, last edited by DrCaduceus on 19 Oct 2014 12:34
Table of Contents
What is a category?
In principle, a category is a class (think of a name or concept) that serves to group together related things, like objects, ideas, etc. Thus, cars is a category for certain type of vehicles, different to that of motorcycles, or trucks. The main advantages of categories are, thus, to group related objects (those pertaining to the same category) as well as to differentiate them from unrelated ones (those pertaining to different categories).
What is a category in Wikidot?
In Wikidot, categories have similar connotations. However, categories are rather a tool for Site managers, and not so much for users. Let's be a bit more specific here:
- The best way of categorizing pages at user's level is with the Tags function. This way each page can be categorized into its most relevant tags, and the site will list them automatically under those tags. This facilitates searching for related pages by using the Tags cloud.
- At administrator's level, however, you can use categories to better manage your site. For example, you can set different themes for each category (e.g. a picture of motorcycles or of cars, depending on the category), set different permissions for each category and change those permissions as you see fit over time. It is at this level that Wikidot categories work.
If you want to see how "Categories" are set up, go to Site manager->Appearance->Themes and you may see there a list showing all the existing categories within a site. Alternatively you can use Site Manager->Permissions to see the same list.
This means that there are different categories of pages which divide a site into manageable sections. Some categories are editable by everybody, others are only editable by site members, and others are restricted to administrators only. Using the theme manager, each category can have its own theme or appearance, with navigation elements (such as sidebar menus) tailored for each separate category. For example, if you have a wiki about the history of the Napoleonic Wars, you can include a completely separate category within that wiki about Period Uniforms/Dress. Keeping the two subjects in the same wiki is clearly preferred, but mixing all those pages up together could lead to some messy navigation issues. Separating them by using different categories solves the problem.
How to create categories step-by-step
Step one: create a category
Categories are created automatically with the Add a new page function in your wiki. In order to create a category, make sure that you name the page as categoryname:pagename. For example, you want the category cars, and the first page you want to write about is BMW. Then you Add a new page entitled cars:BMW.
When the editor opens, you will notice that you have a page entitled cars:BMW. What you don't notice is that Wikidot has also created a category called cars, to which this page pertains.
Once you hit the Save button in your editor, the following will happen in your wiki:
- a category: a new category will be created with the name cars (this is so because you commanded it by writing cars: in your title). Notice that if you don't want to create a new category…do not use anyname:…!
- a page name: a new page, pertaining to the category cars:, is created with the name cars:BMW (this is so because you commanded adding a new page entitled "BMW" to be category "cars:"). However, pages pertaining to Wikidot's standard categories (e.g. system, admin, etc.) will only show the title but not the category they pertain to (e.g. you add a new page as system:XXX, but the editor opens a page entitled XXX). This is so because Wikidot hides the category part. To make sure that your page pertains to a given category, you can always read the page URL (it will show http://www.../system:XXX).
- a page title: the title of your page will probably appear as cars:BMW but its title can now be simplified to BMW. If you re-edit the page and delete the cars: part of the title, the page will be listed as BMW…but it is still under the "cars:" category (you can double-check this by looking at the URL!). This is handy if you don't want to show the category name in the title for aesthetic reasons. However, if you have similar titles for pages in different categories (e.g. motorcycles:BMW, and manufacturers:BMW), they will all be listed with the same title (in our case, BMW). To make sure you are writing under the right category, double-check the URL!
To summarize, then. To create a category, Add a new page using the "create page" in the "nav-side". Create this page by first putting in the category name, followed by : and then the page name itself , e.g.:
Step two: add more pages to your category
Any pages that you want to include into a category needs to be entitled categoryname:pagename. By so doing, Wikidot automatically puts the new page into the corresponding category. For example, cars:Mercedes, or cars:Volvo. Again, after you have Saved the page, you can re-edit it and delete the category: part off your title knowing that you will be able to see its category in the URL of the page.
In brief, to continue to add new pages to this new category using "Add a new page", just type the category name, : and the new page name. eg
(Note: any internal wiki pages that reference a page within a specific category MUST have the category name listed as part of the page name. For instance, "page2" is not the same page as "Newcat:page2").
Step three: re-allocate pages to other categories
As always happens, you may find yourself in the predicament of having the right page in the wrong category. For example, you put Seat under motorcycles: and you want to change it to its appropriate category cars:. If you edit the page and change the original title motorcycles:Seat to cars:Seat, the page will still remain in the category motorcycles: but with the new title cars:Seat. This is so because you are only changing the page title and not the page name.
To change the page name to the appropriate category, you need to go to the page (use Search, List all pages, or Tags), click on +options and, then, Rename. Rename the page into cars:Seat, and your page will be moved to the cars: category. What you are doing in this step is acting upon the page name, effectively changing the page to a different name and, thus, category. Indeed, you can double-check the URL, and you will see the page in its new category.
If necessary, you now need to go and change the title of the page. For this, you need to Edit your page and change the title to cars:Seat (or, simply, Seat). In this step you are acting upon the page title (otherwise, if you don't change the title, it will still read the same -e.g. motorcycles:Seat-, but will be under other category -i.e. cars:).
Step four: manage your categories
If you now go and look into Site manager — Permissions you will notice that any new category (e.g. Newcat) is in there. You will also notice other existing categories in the list provided (these were automatically set up at the time the wiki was created). Do not delete any of these, if you want your site to work correctly!
Different permissions can now be assigned to each category as necessary.
Other features, such as appearance, navigational elements, etc, can also be tailored to each particular category.
Assigning pages to categories automatically
You might find it useful to assign pages to their categories automatically instead of having to write the category manually. Furthermore, this is most helpful if your site has different categories and it is open to the contribution of others. Other people are less aware of how the site is structured, and will probably create new pages in the "_default" category. This means that you will probably have to go back and rename pages into their appropriate categories continuously.
A nice solution is to build Add a new page functions into your site which automatically allocate pages to their corresponding categories.
Step one: create your category
The first step is to create a category as we did above (e.g. for cars).
For the time being, however, let's say we are creating a category from scratch. Thus, do the following:
- Create a category called Food by way of creating a new page called food:addpage.
- Save the page.
This will automatically create the category Food and a page called AddPage.
Step two: build in the Add a new page function
Now we want to build in the Add a new page function within the category Food. To do so, we need to add the corresponding syntax (a module, actually) into a page in that category. But, because we already have a page called AddPage (which has no relation to food whatsoever!), we can use that page.
In our example, we, thus, do the following:
- Open the page Food:AddPage.
- Edit it and write the following code:
[[module NewPage category="food"]]
- Save the page.
When you have finished, you will have a functional Add a new page with a difference: every page created using this function automatically adds the new page to the category Food (check the URL and you will see it)!
Step three: tailoring your Add a new page function
By now, you may want to tailor this function to your needs. The most obvious one is to rename it, for example, to rename the button to new food. You can edit the syntax as appropriate, for example:
[[module NewPage category="food" size="15" button="new food"]]
This syntax will give you an Add a new page button similar to the one that you got by default in Wikidot's Side navigation panel. The only exceptions are that it opens a new page in the category Food: (instead of in the "_default:" category), and it names the button as new food (instead of as "new page").
By now, you may as well wonder whether you could write this function in your Side navigation panel or not. Yes, you can! Simply copy and paste above syntax onto the nav:side page.
You can even substitute the original "new page'' button with the new food one.
This "tailoring" exercise is to show you that once you have a Category:addpage created, you can put that function in other pages, such as the side navigation panel, a page specifically created for adding new pages, a starting page for the category, etc. And, by the way, the page does not need to be called AddPage. It could, as well, be your Start page for the category, or any other page.
Step four: "new pages" for more than one category
By following above steps, you can create further Add a new page functions for multiple categories. However, you may find it handy to put all those functions in one place after renaming each of them appropriately to avoid confusion. Two options are suggested in order to list them in a place that is convenient for your contributors:
- List them in the Side navigational panel. This is quite convenient but impractical if you have many categories.
- Edit the Add a new page function from your Side panel so that it links (and opens) a new page where you have listed all those category-linked "new pages". This is quite convenient if you have multiple categories.
An SB collaboration between