In this article, we will explain how to create HTML sitemap pages in WordPress without any plugin and why it is important for your WordPress site.
Importance of HTML Sitemap Pages
An XML sitemap essentially does the same thing to search engine crawlers, making it easier for them to find and index pages on your web. Even if your internal linking is not very good, XML sitemaps will be good for SEO, as it enables Google to find your important website pages easily. Similarly, HTML sitemaps do essentially the same thing for visitors and users, making it easier for them to find your web pages. Even if you have more and more posts on your site.
As an experienced operator, you must know how important a sitemap can be to your WordPress site. If you want to make your visitors easy to use and get more organic traffic, you should create and deploy an HTML sitemap. If you want to reduce the bounce rate of your WordPress site, you should also create an HTML sitemap so that your site visitors can easily find the content they are looking for in your site quickly. HTML sitemap for WordPress is not only search engine friendly but also user friendly. Your visitors can browse your site using HTML sitemaps and easily find posts, pages or articles on your site. HTML sitemaps make it easy for both users and search engines to find content on your WordPress blog and site.
In this post, we will discuss how to create HTML sitemap page for WordPress. You will learn how to create a WordPress HTML sitemap, then create an HTML sitemap page for WordPress to display the actual sitemap to front-end visitors. Since there are a lot of plugins that help WordPress users to create an HTML sitemap. But we would recommend you to create WordPress HTML sitemap manually without any plugin unless you have existing WordPress plugin, as WordPress does not come with any special feature to create HTML sitemap. Please note that creating HTML sitemaps in WordPress requires a touch of WordPress’s PHP code, although it is not difficult.
By following the steps below, you will be able to create an HTML sitemap page like this.
Step 1. Create HTML Sitemap File in WordPress File Manager
To Create a WordPress HTML Sitemap Template File In the Debug Console of WordPress on your hosting server, log in to your hosting control panel. You can also create this sitemap file on your local computer, and then upload it to your WordPress hosting server later. They are different ways of doing the same thing. In this demo, we’ll use WordPress cPanel or Debug Console or File Manager to show you how to easily create a WordPress HTML sitemap. Log in to cPanel, go to Files >> File Manager. wp-content >> browse to the themes folder, open the current WordPress theme folder and create a sub-folder called “mysitemap” or something more descriptive, then create the html WordPress template below with the name of “sitemap.php” or anything that you like.
If you are using Microsoft Azure, go to “Advance Tools” in the Dashboard and click “Go” to open your Diagnostic Console or Debug Console. Then click on Debug Console given in the Menu bar. then click on sit > wwwroot > wp-content > themes > generatepress (etc.) file. Click on plus icon (+) then click on “New folder” and name it “sitemap-template.php” then in that new folder add below php code and modify meta tag and analytics designing code as per your wish, Do not modify the rest of the PHP code further, then save it.
<!DOCTYPE html><html lang="en-US"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>Sitemap - Your site name</title><meta name="description" content="This is the HTML sitemap of the Your site name website." /><link rel="canonical" href="Your site url/sitemap" /><meta name="robots" content="follow, index" /><meta name="google-site-verification" content="your verification id" /><!-- Global site tag (gtag.js) - Google Analytics --><script async src="https://www.googletagmanager.com/gtag/js?id=UA-########-1"></script><script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-########-1');</script><meta name="msvalidate.01" content="your verification id" /><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-###############" crossorigin="anonymous"></script></head><body><center><font size="2" color="#E50DDE"><h1><u>Sitemap of Your site name</u></h1></font></center><h2 id="sitemap-pages">Pages</h2><ul><?php wp_list_pages( array( 'exclude' => '788888888, 6666666666', 'title_li' => '', ));?></ul><h2 id="sitemap-posts">Posts</h2><ul><?php $postsArgs = array( 'post_type' => 'post', 'posts_per_page'=>'-1', // 'post__not_in' => array(), );$postsLoop = new WP_Query( $postsArgs );while ( $postsLoop->have_posts() ) { $postsLoop->the_post();?> <li <?php post_class(); ?>><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li><?php } wp_reset_query(); ?></ul><h2 id="sitemap-posts-categories">Post Categories</h2><ul><?php wp_list_categories( array( 'title_li' => '', 'show_count' => false,// 'exclude' => array(),) ); ?> </ul><h2 id="sitemap-posts-tags">Post Tags</h2><?php $tags = get_tags(array( // 'exclude' => '', ));if ($tags) { ?><ul> <?php foreach ($tags as $tag) { ?> <li class="tag-id-<?php echo $tag->term_id ?>"><a href="<?php echo get_tag_link( $tag->term_id );?>"><?php echo $tag->name ?></a></li> <?php } ?></ul><? } ?><center><h4><u>Thanks for visiting and using our Sitemap</u></h4></center></body></html>
Step 2 . Create HTML Sitemap Page in WordPress Pages Section
Go to WordPress Dashboard >> Pages >> Add New to create a new WordPress page, and make sure to select Sitemap in the Page Attributes box and then Publish this Page. Preview this WordPress HTML sitemap page now, and do whatever customizations you feel are necessary.
Now in your sitemap that is being prepared, if you do not want to display any page, then place the cursor on that page and click on Inspect and copy the page item number of that page and in the coding of the template of that sitemap in exclude and type that number then click on save, as there are redundant numbers written there by default, delete them. This will cause that page to not be displayed in the HTML sitemap.
Conclusion
Now you know how to create an HTML sitemap page for your WordPress blog without any additional plugins and you don’t have to worry about it as it will not burden your WordPress hosting. Your WordPress sites can be faster and safer with fewer plugins.
Able People Encourage Us By Donating : सामर्थ्यवान व्यक्ति हमें दान देकर उत्साहित करें।
Thanks for reading: Create HTML sitemap in WordPress without plugin, Please, share this article. If this article helped you, then you must write your feedback in the comment box.