定制 elektrorl/metatag_ai_generate 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

elektrorl/metatag_ai_generate

Composer 安装命令:

composer require elektrorl/metatag_ai_generate

包简介

AI-powered SEO meta description generator for Drupal using the AI module framework

README 文档

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

Drupal PHP License

FeaturesInstallationConfigurationUsageTroubleshootingMultilingual 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

  1. Via Composer (recommended):

    composer require drupal/metatag drupal/ai drupal/key
    composer require drupal/metatag_ai_generate
  2. Or download manually from Drupal.org

Step 2: Enable the Modules

  1. Go to Extend (/admin/modules)
  2. Search for "Metatag AI Generate"
  3. 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:

  1. 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
  1. Get an API key from your chosen provider:

Configuration

Configure API Key

  1. Go to ConfigurationSystemKeys (/admin/config/system/keys)
  2. Click + Add key
  3. Fill in:
    • Key name: anthropic_api_key (or your provider name)
    • Key type: Authentication
    • Key provider: Configuration
    • Key value: Paste your API key
  4. Click Save

Configure Metatag AI Generate

Navigate to: ConfigurationSearch and metadataMetatag 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

  1. Create or edit content (e.g., an Article or Page)
  2. Scroll to the Metatag section (usually in the right sidebar)
  3. Click the "Generate with AI" button
  4. Wait 1-2 seconds while AI analyzes your content
  5. Review the generated description in the Description field
  6. 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:

  1. Go to ConfigurationSearch and metadataMetatag AI Generate
  2. Check that the module is enabled (checkbox at top)
  3. Check that your content type is selected in Enabled Content Types
  4. Clear Drupal cache: ConfigurationDevelopmentPerformanceClear all caches

"No AI provider configured" error

Solution:

  1. Go to ConfigurationSearch and metadataMetatag AI Generate
  2. Make sure you selected an AI Provider from the dropdown
  3. Make sure you selected an API Key (must be created first in Keys module)
  4. Click Save configuration

AI generation fails or returns an error

Check your API key:

  1. Go to ConfigurationSystemKeys
  2. Edit your API key
  3. 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 ReportsRecent 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.

If you find this module helpful, please star it on GitHub!

Report a BugRequest FeatureDiscussions

elektrorl/metatag_ai_generate 适用场景与选型建议

elektrorl/metatag_ai_generate 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 1, 最近一次更新时间为 2026 年 02 月 03 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「seo」 「drupal」 「metatag」 「ai」 「openai」 「claude」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 elektrorl/metatag_ai_generate 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 elektrorl/metatag_ai_generate 我们能提供哪些服务?
定制开发 / 二次开发

基于 elektrorl/metatag_ai_generate 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 30
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0-or-later
  • 更新时间: 2026-02-03