Adding XML Sitemap
I've created a simple installation script that adds a comprehensive XML sitemap to your Waterhole. This helps search engines discover and index all your content.
Features
- Multiple sitemap endpoints organized by content type
- API-style routing (
/sitemap,/sitemap/posts, etc.) - Automatic content discovery for channels, posts, pages, and users
- Proper XML formatting with timestamps, change frequency, and priority
- Error handling - won't crash if a model is missing
- robots.txt integration with sitemap reference
Installation
Download the attached install-sitemap.sh file, upload it to your Waterhole root directory, and run:
chmod +x install-sitemap.sh
./install-sitemap.sh
That's it! The script will automatically create all necessary files and routes.
Available Endpoints
After installation, you'll have these endpoints:
/sitemap- Complete sitemap with all content types/sitemap/posts- Posts only (limited to 1000 most recent)/sitemap/channels- Channels only/sitemap/pages- Static pages only/sitemap/users- User profiles (limited to 500)
SEO Setup
- Update your domain in
public/robots.txt - Test your sitemap:
curl https://your-domain.com/sitemap - Submit to Google Search Console
- Submit to Bing Webmaster Tools
Code Structure
The implementation creates:
app/Http/Controllers/SitemapController.php- Main controller with 5 methods- Routes in
routes/web.phpusing prefix grouping public/robots.txtwith sitemap reference
Each URL includes:
<loc>- Full URL<lastmod>- Last modification timestamp<changefreq>- Update frequency hint<priority>- Relative importance (0.0-1.0)
Why Multiple Endpoints?
For large forums, splitting the sitemap by content type:
- Makes it easier to debug specific content issues
- Allows selective reindexing in search consoles
- Keeps individual sitemaps under the 50k URL limit
- Improves crawl efficiency
Customization
You can adjust limits in the controller:
- Posts: currently
limit(1000) - Users: currently
limit(500) - Channels and Pages: no limit (usually small)
Notes
- No
.xmlextension needed - XML content type is set via headers - Clean URLs follow the same pattern as the Waterhole API
- Error handling prevents crashes if models aren't available
- Works with unlicensed Waterhole installations
Hope this helps improve your forum's SEO!
Attachment: install-sitemap.sh