elektrorl / metatag_ai_generate
AI-powered SEO meta description generator for Drupal using the AI module framework
Package info
github.com/elektrorl/metatag_ai_generate
Type:drupal-module
pkg:composer/elektrorl/metatag_ai_generate
Requires
- php: >=8.1
- drupal/ai: ^1.1
- drupal/core: ^10.2 || ^11
- drupal/key: ^1.17
- drupal/metatag: ^2.1
Requires (Dev)
- drupal/core-dev: ^10.2 || ^11
README
Metatag AI Generate
AI-Powered SEO Meta Description Generator for Drupal
Automatically generate optimized meta descriptions using cutting-edge AI models directly from your Drupal content editor
Features • Installation • Configuration • Usage • Troubleshooting • Multilingual Support
Why Metatag AI Generate?
Writing compelling, SEO-optimized meta descriptions is time-consuming and requires expertise. Metatag AI Generate eliminates this burden by intelligently analyzing your content and generating professional meta descriptions in seconds.
There is another similar module called Metatag AI.
Metatag AI Generate:
- Manual generation: You click a "Generate with AI" button when YOU want
- Scope: Generates ONLY meta descriptions (not titles)
- Control: Full control - generate, review, edit before saving
- Personas: Customizable AI writing style per site
- Bundle-specific: Enable only for specific content types
Choose this module if you want:
- More control over the generation process
- To review and edit AI suggestions before saving
- To generate only descriptions (keep manual titles)
- To customize the AI writing style
Choose Metatag AI if you want:
- Fully automatic generation on save
- Both titles and descriptions generated together
Key Features
- Lightning Fast: Generate SEO-optimized descriptions in under 2 seconds
- Smart Content Analysis: Automatically extracts and analyzes content from rendered node output
- Multi-Provider Support: Works with Anthropic Claude, Mistral AI, OpenRouter, OpenAI, and more
- Customizable Personas: Define your writing style (professional, creative, technical, etc.)
- SEO-Compliant: Generates 155-200 character descriptions with key information front-loaded in the first 160 characters
- Bundle-Specific: Enable only for content types that need it
- Secure: API keys managed through Drupal's Key module
Installation
Step 1: Install Required Modules
-
Via Composer (recommended):
composer require drupal/metatag drupal/ai drupal/key composer require drupal/metatag_ai_generate
-
Or download manually from Drupal.org
Step 2: Enable the Modules
- Go to Extend (
/admin/modules) - Search for "Metatag AI Generate"
- Check the box and click Install
Or use command line:
drush en metatag_ai_generate -y
Step 3: Install an AI Provider & Get API Key
Choose one provider and install its Drupal module:
- Install the provider module via Composer:
# Anthropic Claude composer require drupal/ai_provider_anthropic # Mistral AI composer require drupal/ai_provider_mistral # OpenRouter composer require drupal/ai_provider_openrouter # OpenAI composer require drupal/ai_provider_openai
- Get an API key from your chosen provider:
- Anthropic Claude: console.anthropic.com
- Mistral AI: console.mistral.ai
- OpenRouter: openrouter.ai (access to 100+ models)
- OpenAI: platform.openai.com
Configuration
Configure API Key
- Go to Configuration → System → Keys (
/admin/config/system/keys) - Click + Add key
- Fill in:
- Key name:
anthropic_api_key(or your provider name) - Key type: Authentication
- Key provider: Configuration
- Key value: Paste your API key
- Key name:
- Click Save
Configure Metatag AI Generate
Navigate to: Configuration → Search and metadata → Metatag AI Generate
(/admin/config/search/metatag-ai-generate)
| Setting | What to do |
| Enable Module | Check to activate AI generation |
| AI Provider | Select your provider (Anthropic, Mistral, OpenRouter, or OpenAI) |
| API Key | Select the key you created above |
| Persona | Define your writing style, e.g.: • "a professional content writer specializing in SEO"• "a creative copywriter focused on user engagement"• "an e-commerce content specialist"
|
| Enabled Content Types | Check content types where you want AI generation (e.g., Article, Page) |
Click Save configuration
Usage
Generate Meta Descriptions
- Create or edit content (e.g., an Article or Page)
- Scroll to the Metatag section (usually in the right sidebar)
- Click the "Generate with AI" button
- Wait 1-2 seconds while AI analyzes your content
- Review the generated description in the Description field
- Edit if needed, then click Save
That's it! Your content now has an SEO-optimized meta description.
How It Works
Content Extraction:
- The module renders your node in "full" view mode
- Extracts plain text from the rendered output (max 5000 characters)
- Includes all visible content: title, body, custom fields, and any displayed data
- Strips HTML tags and normalizes whitespace
AI Generation:
- Sends the extracted content to your configured AI provider
- Uses your custom persona to set the writing style
- Generates descriptions between 155-200 characters
- Front-loads the most important information in the first 160 characters (guaranteed visible on all devices)
- Characters 161-200 can add additional context (may be truncated on mobile)
Best Practice (2026):
- Google displays approximately 155-160 characters on all devices
- Up to 200 characters accepted for additional context
- Always put key information first for maximum visibility
Troubleshooting
"Generate with AI" button doesn't appear
Solution:
- Go to Configuration → Search and metadata → Metatag AI Generate
- Check that the module is enabled (checkbox at top)
- Check that your content type is selected in Enabled Content Types
- Clear Drupal cache: Configuration → Development → Performance → Clear all caches
"No AI provider configured" error
Solution:
- Go to Configuration → Search and metadata → Metatag AI Generate
- Make sure you selected an AI Provider from the dropdown
- Make sure you selected an API Key (must be created first in Keys module)
- Click Save configuration
AI generation fails or returns an error
Check your API key:
- Go to Configuration → System → Keys
- Edit your API key
- Make sure the key value is correct (no extra spaces)
Check your provider's dashboard:
- Verify your API key is active
- Check you have available credits/quota
- Check for any service outages
Still not working?
- Check Reports → Recent log messages for detailed error messages
- Contact your AI provider's support if the error is on their side
Multilingual Support
Metatag AI Generate is available in 6 languages with complete professional translations:
| Language | Code | Status |
|---|---|---|
| 🇬🇧 English | en |
✅ Native |
| 🇫🇷 Français | fr |
✅ Complete |
| 🇪🇸 Español | es |
✅ Complete |
| 🇩🇪 Deutsch | de |
✅ Complete |
| 🇨🇳 简体中文 | zh-hans |
✅ Complete |
| 🇯🇵 日本語 | ja |
✅ Complete |
License
This module is licensed under the GNU General Public License v2.0 or later.