Create Sitemap and RSS Feed for Custom WP Theme


Uncategorized

Updated May 12th, 2022

Without A Plugin

Perishable Press has the best article yet here. If going with the WordPress default you can customize here. He also has a post on robots.txt here. Learn more about sitemaps overall directly from the source here.

The lingering question I have is is it a page template or hard coded? It seems stupid to be hard-coded so how do you convert a dot pHP file to a .XML file? And then as the perishable press article explains if WordPress is automatically generating the XML file should we just use that file or do we need to shut it off. Also how come we update robots.txt so it points to the site map.

I’m not totally against the plugin here.


<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="https://primetimeasnj.com/wp-sitemap.xsl" ?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url><loc>https://primetimeasnj.com/</loc></url>
<url>
      <loc>https://www.primetimeasnj.com/about/</loc>
      <lastmod>2022-04-01</lastmod>
      <changefreq>yearly</changefreq>
      <priority>0.8</priority>
   </url>
<url><loc>https://primetimeasnj.com/privacy-policy/</loc></url>
<url><loc>https://primetimeasnj.com/contact/</loc></url>
<url><loc>https://primetimeasnj.com/classes/</loc></url>
<url><loc>https://primetimeasnj.com/join/</loc></url>
<url><loc>https://primetimeasnj.com/terms-privacy-cookies/</loc></url>
<url><loc>https://primetimeasnj.com/our-teams/</loc></url>
</urlset>

Here is an article about generating an HTML sitemap. This is what I used for Primetime. I removed the custom post type section even though the site has custom post types because currently the custom post types should not be displayed on their own page.

Submit the URL to Google via the Google Search Console.

Note: typically before submitting a sitemap, you will need to verify your domain in the Google Search Console by adding a TXT record (Google provides) to your hosting provider.

There are XML and HTML sitemaps. The difference is that XML sitemaps are written for search engines and HTML sitemaps are written for humans.

Here is an article about generating an XML sitemap. I don’t understand the code that they say you add to functions.php.

This is an interesting article as well.

Colby Fayock’s WP Starter Generates a sitemap.xml file and I wonder how they do it. Here is a link to an example.xml file.

With A Plugin

Seems like Yoast SEO is the way to go. It has 5m active installations. How much bloat is this thing adding? How does it affect the development/deployment process?