FastBots: Kọ Aṣa Aṣa wodupiresi XML SUNNA Fun Ikẹkọ AI Bot Rẹ

Martech Zone ni o ni egbegberun ìwé, pẹlu ọpọlọpọ awọn ti wọn igba atijọ. Mo ti ṣiṣẹ lori aaye naa fun ọdun pupọ lati yọkuro tabi ṣe imudojuiwọn awọn ọgọọgọrun awọn nkan, ṣugbọn Mo tun ni ọpọlọpọ diẹ sii. Ni akoko kanna, Emi yoo fẹ lati kọ bot ede adayeba pẹlu akoonu mi, ṣugbọn ohun ti o kẹhin ti Mo fẹ ṣe ni ikẹkọ lori awọn nkan ti igba atijọ.

FastBots ni a GPTAkole bot ti o ni agbara ti o le kọkọ kọkọ ni lilo maapu aaye rẹ (tabi awọn aṣayan miiran). Mo nilo maapu oju opo wẹẹbu kan ti o wa pẹlu gbogbo awọn nkan ti a ṣe atunṣe lati ọjọ kan pato. Ni afikun, Mo fẹ lati ṣafikun awọn oju-iwe mi ati awọn adape (a aṣa ifiweranṣẹ iru). Emi ko fẹ lati ni awọn oju-iwe ifipamọ fun awọn ẹka ati awọn afi tabi ni oju-iwe ile mi nitori o tun jẹ ile ifipamọ.

Lilo koodu ti Mo n pese ni opin nkan yii; Mo ti kọ aṣa itanna WordPress ti o ṣẹda aṣa kan XML maapu oju opo wẹẹbu ti o ntu ni agbara ni gbogbo igba ti Mo ṣe atẹjade ifiweranṣẹ kan. FastBots ko ni ọna atunṣe adaṣe adaṣe bi MO ṣe ṣe atẹjade nkan kọọkan, ṣugbọn eyi jẹ aaye ibẹrẹ nla fun lilo pẹpẹ.

Maapu aaye naa gbe gbogbo awọn ọna asopọ wọle lati kọ ẹkọ naa AI Bot lori:

Gbogbo awọn oju-iwe ti wa ni agbewọle bayi, ati pe o le kọ bot rẹ lori data to wulo. O tun ni aye lati yọ awọn oju-iwe kan pato kuro. FastBots tun gba mi laaye lati ṣe akanṣe iyasọtọ AI bot ati paapaa pẹlu ọna asopọ kan si nkan ti o yẹ ninu esi mi. Ibeere asiwaju tun wa ti a ṣe sinu pẹpẹ.

Syeed naa ṣiṣẹ laisi abawọn… o le fun bot mi ni awakọ idanwo kan nibi:

Ifilole Martech ZoneBot, Marty Kọ FastBots AI Bot rẹ

Aṣa XML Aaye maapu

Dipo ki o ṣafikun iṣẹ ṣiṣe yii si akori mi, Mo kọ aṣa kan WordPress itanna lati kọ jade kan Aaye maapu. Kan ṣafikun iwe ilana ninu folda awọn afikun rẹ, lẹhinna a PHP faili pẹlu koodu atẹle:

<?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');
Jade ẹya alagbeka