feat: 新增AI SEO助手插件,支持自动生成SEO内容和导航主题适配
添加完整的AI SEO助手WordPress插件,主要功能包括: - 集成Dify API自动生成SEO优化的标题、描述和关键词 - 支持导航主题的自定义字段适配 - 提供管理界面设置API和文章类型支持 - 包含前端SEO标签自动应用功能 - 添加详细的测试和调试功能
This commit is contained in:
96
AI SEO 助手/admin/settings.php
Normal file
96
AI SEO 助手/admin/settings.php
Normal file
@@ -0,0 +1,96 @@
|
||||
<div class="wrap">
|
||||
<h1>AI SEO Generator 设置</h1>
|
||||
|
||||
<form method="post" action="">
|
||||
<table class="form-table">
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<label for="api_key">API Key</label>
|
||||
</th>
|
||||
<td>
|
||||
<input type="text" id="api_key" name="api_key" value="<?php echo esc_attr($api_key); ?>" class="regular-text" />
|
||||
<p class="description">输入您的Dify API Key</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<label for="api_url">API URL</label>
|
||||
</th>
|
||||
<td>
|
||||
<input type="url" id="api_url" name="api_url" value="<?php echo esc_attr($api_url); ?>" class="regular-text" />
|
||||
<p class="description">Dify API的基础URL</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<label for="supported_post_types">支持的文章类型</label>
|
||||
</th>
|
||||
<td>
|
||||
<?php
|
||||
// 获取所有公开的post类型
|
||||
$all_post_types = get_post_types(array('public' => true), 'objects');
|
||||
$supported_post_types = get_option('ai_seo_supported_post_types', array_keys($all_post_types));
|
||||
|
||||
foreach ($all_post_types as $post_type_name => $post_type_obj) {
|
||||
$checked = in_array($post_type_name, $supported_post_types) ? 'checked' : '';
|
||||
echo '<label style="display: block; margin-bottom: 5px;">';
|
||||
echo '<input type="checkbox" name="supported_post_types[]" value="' . esc_attr($post_type_name) . '" ' . $checked . ' /> ';
|
||||
echo esc_html($post_type_obj->label) . ' (' . esc_html($post_type_name) . ')';
|
||||
echo '</label>';
|
||||
}
|
||||
?>
|
||||
<p class="description">选择在哪些文章类型的编辑页面显示AI SEO Generator</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<?php submit_button('保存设置'); ?>
|
||||
</form>
|
||||
|
||||
<div class="ai-seo-info">
|
||||
<h2>使用说明</h2>
|
||||
<ol>
|
||||
<li>在上方输入您的Dify API Key和API URL</li>
|
||||
<li>编辑文章或页面时,在编辑器下方会出现"AI SEO Generator"面板</li>
|
||||
<li>点击"生成SEO内容"按钮,AI将自动为您生成优化的标题、描述和关键词</li>
|
||||
<li>生成的内容会自动应用到页面的meta标签中</li>
|
||||
</ol>
|
||||
|
||||
<h3>API配置</h3>
|
||||
<p>请在上方配置您的API密钥和URL以使用AI生成功能。</p>
|
||||
<p><strong>端点:</strong> POST /chat-messages</p>
|
||||
|
||||
<h3>功能特性</h3>
|
||||
<ul>
|
||||
<li>✅ 自动生成SEO标题</li>
|
||||
<li>✅ 自动生成Meta描述</li>
|
||||
<li>✅ 自动生成关键词</li>
|
||||
<li>✅ 前端自动应用SEO标签</li>
|
||||
<li>✅ 支持文章和页面</li>
|
||||
<li>✅ AJAX异步生成</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.ai-seo-info {
|
||||
margin-top: 30px;
|
||||
padding: 20px;
|
||||
background: #f9f9f9;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.ai-seo-info h2, .ai-seo-info h3 {
|
||||
margin-top: 0;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.ai-seo-info ul, .ai-seo-info ol {
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
.ai-seo-info li {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
</style>
|
Reference in New Issue
Block a user