AISEOMeta is a MediaWiki extension that automatically generates SEO Meta tags for Wiki pages using AI (Gemini or OpenAI) via Job Queue.
-
Clone or download this repository into your
extensions/directory:cd extensions/ git clone https://github.com/yourusername/AISEOMeta.git -
Install PHP dependencies using Composer:
cd AISEOMeta composer install --no-dev -
Add the following code at the bottom of your
LocalSettings.php:wfLoadExtension( 'AISEOMeta' );
-
Configure the extension in your
LocalSettings.php(see Configuration section below). -
Done! Navigate to Special:Version on your wiki to verify that the extension is successfully installed.
You can configure the extension by adding the following variables to your LocalSettings.php:
$wgASMTargetNamespaces: An array of namespace IDs where the extension should generate and display SEO tags. Default is[ 0 ](Main namespace).$wgASMProvider: Choose the AI provider. Valid options are'openai'or'gemini'. Default is'openai'.$wgASMPromptTemplate: The prompt template sent to the AI. Use{text}as a placeholder for the page content.
$wgASMOpenAIEndpoint: The endpoint for the OpenAI compatible API. Default is'https://api.openai.com/v1/chat/completions'.$wgASMOpenAIKey: Your OpenAI API Key.$wgASMOpenAIModel: The OpenAI model to use. Default is'gpt-3.5-turbo'.$wgASMOpenAIAdditionalParams: Additional parameters to pass to the OpenAI compatible API (e.g.,temperature,max_tokens,enable_search). Default is['temperature' => 0.3, 'max_tokens' => 512].
$wgASMGeminiKey: Your Gemini API Key.$wgASMGeminiModel: The Gemini model to use. Default is'gemini-2.0-flash'.
// Use OpenAI
$wgASMProvider = 'openai';
$wgASMOpenAIKey = 'your-openai-api-key';
$wgASMOpenAIModel = 'gpt-4-turbo';
// Optional: Add extra parameters for OpenAI compatible APIs
// $wgASMOpenAIAdditionalParams = [
// 'temperature' => 0.3,
// 'max_tokens' => 512,
// 'enable_search' => true
// ];
// Or use Gemini
// $wgASMProvider = 'gemini';
// $wgASMGeminiKey = 'your-gemini-api-key';
// $wgASMGeminiModel = 'gemini-2.0-flash';You can define custom meta tags that will be merged with the AI-generated tags. Create or edit the page MediaWiki:ASM-custom-tags on your wiki and add tags in the format name|content, one per line.
Example:
author|Your Wiki Name
robots|index, follow
The extension provides a Special Page (Special:AISEOMeta) that acts as an administrative console. From this console, administrators can:
- View Current Configuration: Check which AI provider is active and whether API keys are set (keys are masked for security).
- Query Page Status: Enter a page title to see its current AI-generated SEO tags and the exact timestamp of when they were last generated.
- Manual Regeneration: Push a specific page to the Job Queue for immediate regeneration directly from the query results.
- Batch Regeneration: Enter multiple page titles (one per line) to push them all to the Job Queue at once.
To access the console, navigate to Special:AISEOMeta on your wiki.
The extension provides maintenance scripts to manage the generated SEO tags. Run these scripts from your MediaWiki installation directory.
Cleans AI-generated SEO meta tags from the page_props table.
- Clean all tags:
php extensions/AISEOMeta/maintenance/CleanSEOMeta.php --all
- Clean tags for a specific page:
php extensions/AISEOMeta/maintenance/CleanSEOMeta.php --page="Main Page"
Regenerates AI SEO meta tags by pushing jobs to the queue.
- Regenerate for all pages in the main namespace:
php extensions/AISEOMeta/maintenance/RegenerateSEOMeta.php --all
- Regenerate for a specific page:
php extensions/AISEOMeta/maintenance/RegenerateSEOMeta.php --page="Main Page" - Force regeneration even if tags already exist:
php extensions/AISEOMeta/maintenance/RegenerateSEOMeta.php --all --force
MIT License