人工智能内容营销营销工具

FastBots:构建自定义 WordPress XML 站点地图来训练您的 AI 机器人

Martech Zone 有数千篇文章,其中许多已经过时。 我在该网站上工作了几年,删除或更新了数百篇文章,但我还有更多文章。 同时,我想用我的内容训练一个自然语言机器人,但我最不想做的就是在过时的文章上训练它。

快速机器人 是一个 ChatGPT- 驱动的机器人构建器,您可以使用站点地图(或其他选项)进行初始训练。 我需要一个经过筛选的站点地图,其中包含自特定日期以来修改的所有文章。 此外,我想包括我的页面和 首字母缩写词 (自定义帖子类型)。 我不想包含类别和标签的存档页面或拥有我的主页,因为它也是一个存档。

使用我在本文末尾提供的代码; 我构建了一个自定义 WordPress 插件来创建自定义 XML 每次我发布帖子时都会动态刷新站点地图。 当我发布每篇文章时,FastBots 没有自动重新训练方法,但这是使用该平台的一个很好的起点。

站点地图导入所有链接来训练 AI 机器人上:

FastBots:从您网站的站点地图训练机器人。

所有页面现已导入,您可以根据适用的数据训练您的机器人。 您还可以删除特定页面。 FastBots 还允许我自定义 AI 机器人的品牌,甚至在我的回复中包含相关文章的链接。 该平台还内置了潜在客户请求。

该平台运行完美……您可以在这里试驾我的机器人:

实行 Martech Zone的机器人,马蒂 构建您的 FastBots 人工智能机器人

自定义 XML 站点地图

我没有将此功能添加到我的主题中,而是构建了一个自定义 WordPress 用于构建站点地图的插件。 只需在插件文件夹中添加一个目录,然后 PHP 带有以下代码的文件:

<?php
/*
Plugin Name: Bot Sitemap
Description: Dynamically generates an XML sitemap including posts modified since a specific date and updates it when a new article is added.
Version: 1.0
Author: Your Name
*/

// Define the date since when to include modified posts (format: Y-m-d)
$mtz_modified_since_date = '2020-01-01';

// Register the function to update the sitemap when a post is published
add_action('publish_post', 'mtz_update_sitemap_on_publish');

// Function to update the sitemap
function mtz_update_sitemap_on_publish($post_id) {
    // Check if the post is not an auto-draft
    if (get_post_status($post_id) != 'auto-draft') {
        mtz_build_dynamic_sitemap();
    }
}

// Main function to build the sitemap
function build_bot_sitemap() {
    global $mtz_modified_since_date;

    $args = array(
        'post_type' => 'post',
        'date_query' => array(
            'column' => 'post_modified',
            'after'  => $mtz_modified_since_date
        ),
        'posts_per_page' => -1 // Retrieve all matching posts
    );

    $postsForSitemap = get_posts($args);

    // Fetch all 'acronym' custom post type posts
    $acronymPosts = get_posts(array(
        'post_type' => 'acronym',
        'posts_per_page' => -1,
    ));

    // Fetch all pages except the home page
    $pagesForSitemap = get_pages();
    $home_page_id = get_option('page_on_front');

    $sitemap = '<?xml version="1.0" encoding="UTF-8"?>';
    $sitemap .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';

    foreach($postsForSitemap as $post) {
        setup_postdata($post);
        if ($post->ID != $home_page_id) {
            $sitemap .= '<url>'.
                          '<loc>'. get_permalink($post) .'</loc>'.
                          '<lastmod>'. get_the_modified_date('c', $post) .'</lastmod>'.
                          '<changefreq>weekly</changefreq>'.
                        '</url>';
        }
    }

    foreach($acronymPosts as $post) {
        setup_postdata($post);
        if ($post->ID != $home_page_id) {
            $sitemap .= '<url>'.
                          '<loc>'. get_permalink($post) .'</loc>'.
                          '<lastmod>'. get_the_modified_date('c', $post) .'</lastmod>'.
                          '<changefreq>weekly</changefreq>'.
                        '</url>';
        }
    }

    foreach($pagesForSitemap as $page) {
        setup_postdata($page);
        if ($page->ID != $home_page_id) {
            $sitemap .= '<url>'.
                          '<loc>'. get_permalink($page) .'</loc>'.
                          '<lastmod>'. get_the_modified_date('c', $page) .'</lastmod>'.
                          '<changefreq>monthly</changefreq>'.
                        '</url>';
        }
    }

    wp_reset_postdata();

    $sitemap .= '</urlset>';

    file_put_contents(get_home_path().'bot-sitemap.xml', $sitemap);
}

// Activate the initial sitemap build on plugin activation
register_activation_hook(__FILE__, 'build_bot_sitemap');

Douglas Karr

Douglas Karr 首席营销官是 开放洞察 和创始人 Martech Zone。 道格拉斯帮助了数十家成功的 MarTech 初创公司,协助进行了超过 5 亿美元的 MarTech 收购和投资尽职调查,并继续协助公司实施和自动化其销售和营销策略。 道格拉斯是国际公认的数字化转型和 MarTech 专家和演讲者。 道格拉斯还是一本傻瓜指南和一本商业领导力书籍的出版作者。

相关文章

返回顶部按钮
关闭

检测到Adblock

Martech Zone 我们能够免费为您提供这些内容,因为我们通过广告收入、联属链接和赞助从我们的网站中获利。 如果您在浏览我们的网站时删除广告拦截器,我们将不胜感激。