FastBots: สร้างแผนผังเว็บไซต์ WordPress XML แบบกำหนดเองสำหรับการฝึกอบรม AI Bot ของคุณ
Martech Zone มีบทความหลายพันบทความ โดยหลายบทความล้าสมัยแล้ว ฉันทำงานในไซต์นี้มาหลายปีเพื่อลบหรืออัปเดตบทความหลายร้อยบทความ แต่ฉันยังมีบทความอื่นๆ อีกมากมาย ในเวลาเดียวกัน ฉันต้องการฝึกบอทภาษาธรรมชาติด้วยเนื้อหาของฉัน แต่สิ่งสุดท้ายที่ฉันต้องการทำคือฝึกมันกับบทความที่ล้าสมัย
FastBots คือ ChatGPT- เครื่องมือสร้างบอทที่ขับเคลื่อนซึ่งคุณสามารถฝึกฝนได้โดยใช้แผนผังไซต์ของคุณ (หรือตัวเลือกอื่น ๆ ) ฉันต้องการแผนผังไซต์ที่กรองแล้วซึ่งรวมบทความทั้งหมดที่ได้รับการแก้ไขตั้งแต่วันที่ที่ระบุ นอกจากนี้ ฉันต้องการรวมเพจของฉันและ คำย่อ (ประเภทโพสต์ที่กำหนดเอง) ฉันไม่ต้องการรวมหน้าที่เก็บถาวรสำหรับหมวดหมู่และแท็ก หรือมีหน้าแรกของฉัน เนื่องจากเป็นที่เก็บถาวรด้วย
ใช้โค้ดที่ฉันให้ไว้ท้ายบทความนี้ ฉันสร้างปลั๊กอิน WordPress แบบกำหนดเองที่สร้างแบบกำหนดเอง XML แผนผังเว็บไซต์ที่รีเฟรชแบบไดนามิกทุกครั้งที่ฉันเผยแพร่โพสต์ FastBots ไม่มีวิธีการฝึกอบรมอัตโนมัติในขณะที่ฉันเผยแพร่แต่ละบทความ แต่นี่เป็นจุดเริ่มต้นที่ดีสำหรับการใช้แพลตฟอร์ม
แผนผังเว็บไซต์นำเข้าลิงก์ทั้งหมดเพื่อฝึกอบรม AI เปิดบอท:
ตอนนี้นำเข้าเพจทั้งหมดแล้ว และคุณสามารถฝึกบอทของคุณเกี่ยวกับข้อมูลที่เกี่ยวข้องได้ คุณยังมีโอกาสที่จะลบเพจบางเพจได้อีกด้วย FastBots ยังอนุญาตให้ฉันปรับแต่งแบรนด์ของบอท AI ของฉันและยังรวมลิงก์ไปยังบทความที่เกี่ยวข้องในการตอบกลับของฉัน นอกจากนี้ยังมีคำขอโอกาสในการขายที่สร้างไว้ในแพลตฟอร์มอีกด้วย
แพลตฟอร์มทำงานได้อย่างไร้ที่ติ... คุณสามารถทดลองขับบอทของฉันได้ที่นี่:
ยิง Martech Zoneบอท, มาร์ตี้ สร้างบอท AI ของ 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');