Linking Pages & Using Categories â Building Your Wiki Structure
In this tutorial, you'll create new pages on your MediaWiki wiki, link them together, and organize them with categories. This is Lesson 4 of our project: Build Your Own Documentation Wiki.
What You'll Build Today
By the end of this lesson, your wiki will have:
- 3 topic pages with real content
- A category system organizing them
- Navigation from the Main Page to all topic pages
- A category page listing all pages in each category
Your wiki transforms from a single page into a connected knowledge base.
Why Links and Categories Matter
A wiki is not a document. It's a web of connected pages. The power of a wiki comes from links:
- Readers discover related content naturally
- Search engines understand your structure
- Your wiki grows organically â each new page connects to existing ones
Categories group related pages together. Think of them like tags in a blog, but more powerful â category pages auto-generate a list of all pages in that category.
Step-by-Step: Create Pages and Link Them
Step 1: Understand the Red Link Concept
Remember from Lesson 3 that [[Page Title]] creates a link. If the page doesn't exist yet, it appears in red. Clicking a red link takes you directly to the "create this page" editor.
This is by design. Red links are MediaWiki's way of saying: "This page should exist. Create it."
Step 2: Edit Your Main Page to Add Links
Log in to your wiki and click "Edit" on the Main Page.
Add this section at the bottom:
== Documentation Topics ==
Here are the main topics covered in this wiki:
* [[Project Setup Guide]]
* [[API Reference]]
* [[Troubleshooting Common Errors]]
Click "Show preview". Notice the three links appear in red â those pages don't exist yet. That's fine. We're about to create them.
Write an edit summary: Added links to documentation topics
Click "Publish changes".
Step 3: Create Your First Page â Project Setup Guide
Click the red link Project Setup Guide. This takes you to the editor for a new page. The page is empty â it's waiting for you to write.
Type the following content:
== Project Setup Guide ==
This guide walks through setting up the project for the first time.
== Prerequisites ==
Before starting, make sure you have:
* A development environment (we use XAMPP)
* Git installed
* Access to the repository
== Installation Steps ==
# Clone the repository
# Install dependencies
# Configure the database
# Run the server
== Configuration ==
Key configuration files:
* <code>config.php</code> â Database settings
* <code>.env</code> â Environment variables
* <code>LocalSettings.php</code> â Wiki settings
See the [[Configuration Reference]] for all available options.
Write an edit summary: Created Project Setup Guide page
Click "Publish changes".
Notice the link [[Configuration Reference]] is red â that's another page that doesn't exist yet. You're building a web of content, and each new page suggests the next page to create.
Step 4: Create Your Second Page â API Reference
Go back to the Main Page and click the API Reference red link. Add this content:
== API Reference ==
This page documents the public API endpoints.
== Authentication ==
All API requests require an API key. Include it in the header:
<code>Authorization: Bearer YOUR_API_KEY</code>
== Endpoints ==
=== GET /api/users ===
Returns a list of users.
Parameters:
* <code>page</code> â Page number (default: 1)
* <code>limit</code> â Results per page (default: 20)
=== POST /api/users ===
Creates a new user.
Body:
* <code>name</code> â User's full name (required)
* <code>email</code> â User's email address (required)
* <code>role</code> â User role: admin, editor, viewer
== Error Codes ==
| Code | Meaning |
|------|---------|
| 400 | Bad request â check parameters |
| 401 | Unauthorized â invalid API key |
| 404 | Not found â resource doesn't exist |
| 500 | Server error â contact administrator |
See the [[Project Setup Guide]] for setup instructions.
Write an edit summary: Created API Reference page
Click "Publish changes".
Step 5: Create Your Third Page â Troubleshooting Common Errors
Go back to the Main Page and click Troubleshooting Common Errors. Add:
== Troubleshooting Common Errors ==
Common issues and their solutions.
== Database Connection Failed ==
'''Symptom''': Wiki shows "Error connecting to database"
'''Solution''':
# Make sure MySQL is running
# Check database credentials in <code>LocalSettings.php</code>
# Verify the database exists
== White Screen After Installation ==
'''Symptom''': Empty white page when visiting the wiki
'''Solution''':
# Check PHP error log
# Enable <code>mbstring</code> extension in <code>php.ini</code>
# Make sure <code>LocalSettings.php</code> is present and has no whitespace before <code><?php</code>
== Permission Denied ==
'''Symptom''': "You do not have permission to edit this page"
'''Solution''':
# Check if you're logged in
# Verify your user group has edit permissions
# The wiki might be set to read-only for maintenance
See the [[Project Setup Guide]] for installation help.
Write an edit summary: Created Troubleshooting page
Click "Publish changes".
Step 6: Verify All Links Work
Go back to the Main Page. All three links should now be blue â the pages exist! Click each one and confirm they show the content you wrote.
Also check the "What links here" feature:
- Go to the Project Setup Guide page
- In the sidebar (left side), look for "What links here"
- Click it â it shows that the Main Page and API Reference both link to this page
This is another powerful wiki feature. You can always see which pages link to the current page.
Step 7: Add Categories
Now let's organize your pages into categories. Edit the Project Setup Guide and add at the bottom:
[[Category:Setup]]
[[Category:Documentation]]
Edit the API Reference and add:
[[Category:Development]]
[[Category:Reference]]
Edit the Troubleshooting Common Errors and add:
[[Category:Development]]
[[Category:Troubleshooting]]
A page can belong to multiple categories. Add categories by including [[Category:CategoryName]] anywhere in the page â typically at the bottom.
Now look at the bottom of each page. You'll see category links like "Category: Setup" or "Category: Development". Click them.
Each category page shows an auto-generated list of all pages in that category. You didn't create these pages â MediaWiki generated them automatically. This is the power of categories: they give you automatic organization without manual maintenance.
What You Learned
- Red links create new pages when clicked
- Blue links point to existing pages
- Categories auto-generate listing pages
- "What links here" shows backlinks
- A page can belong to multiple categories
In the next lesson, you'll learn about templates â reusable content blocks that make your wiki consistent.
Common Errors
| Error | Why It Happens | How to Fix |
|---|---|---|
| Link stays red after creating the page | Browser cache | Refresh the page (Ctrl+F5). If it's still red, check that you saved the page correctly. |
| Category page shows "No pages found" | You added the category link but the page hasn't been re-saved | Edit the page again, add the category, and save. The category listing updates after each save. |
| "Cannot create page â page already exists" | Someone else created it first | If you're working alone, this shouldn't happen unless you created the page earlier. Just edit the existing page. |
Link text displays as [[Page Name]] instead of being a link |
Double brackets are unbalanced | Make sure you have exactly [[ before the page name and ]] after it. A single bracket [ is for external links. |
| Category name has a space and it looks wrong | Category names are case-sensitive (except the first letter) | MediaWiki capitalizes the first letter automatically. If you typed [[category:setup]], it still shows as "Category:Setup". |
FAQ
How many categories should a page have?
As many as make sense. Common practice is 2-3 categories per page. Too few and pages are hard to find. Too many and the category system becomes noisy.
Can I create subcategories?
Yes. Add [[Category:Parent category]] to a category page itself. For example, edit Category:Development and add [[Category:Documentation]] â now Development is a subcategory of Documentation.
What's the difference between a category and a link?
A link connects two specific pages. A category groups all pages on a related topic. Both are useful, and they work together.
Can I hide a page from categories?
Yes, but why would you? Categories help readers find content. If you must, you can hide a category link by using [[Category:HiddenCategory| ]] (with a space as the sort key).
How do I remove a page from a category?
Edit the page and delete the [[Category:...]] line. The page disappears from the category listing automatically on the next edit.
What's Next
Your wiki now has multiple pages organized into categories. But you're still writing the same content over and over (notice how each page has similar "see also" sections?). Let's fix that.
Continue to Lesson 5: Templates â Write Once, Use Everywhere â you'll create reusable templates that keep your wiki consistent.
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro