Sabbir Ahmed

Sabbir Ahmed

1 month ago

Sitemap Generator for Google Search Console: Improve Indexing

Sitemap generator is the tool you can utilize to generate a comprehensive sitemap and then submit it to Google search console for improved indexing. It is also important for SEO purposes and bringing more traffic to your website. After adding your site to google search console, you also need to generate a sitemap containing list of key URLs of your website. It helps your site to index faster in search results with updated contents. 

In this article, we will see how we can add our website to Google search console and generate sitemap for our application. We will also build our own custom sitemap generator and then add it to Google search console.

Lets add our website to Google search console


Google  search console is the free tool provided by google to get clear and valuable informations such as performance, traffics and other metrics about your website. 

Here are some key reasons why you should add your website to google search console: 

  • Performance monitoring: You can track website's search traffic, impression, clicks, average traffics from search console's dashboard. These are very useful insights which helps you to measure your progress and performance. You can understand audiences behaviors and respond by making significant changes to boost up or attract more audiences. 
  • Identify best keywords: Search console helps you to find out the best keywords which matches to your website or content. 
  • Better search visibility: You can submit sitemap using google search console (The steps are discussed below in details). When you submit website's sitemap to search console, Google's search engine crawler will inspect your site and index the pages accordingly to the search results for relevant keywords people look for. 
  • Find and resolve issues: Search console also provides data about website errors and security issues which helps you to resolve those in the first place. You can also find issues like duplicate contents,  broken links or pages which are costing you to lose traffics constantly.  

Using Domain Property 


For this guide we will need a working website with a active domain. 

Please go to this link and log in to your google account
 

From the left side bar, please click on Add Property

Here you will see 2 ways to proceed, Domain and URL prefix. In the Domain box, we will add our site’s root domain and click continue. 



Then a popup will appear which will give a txt record. 

Copy this txt record  and keep this tab open for later.




Verify Your Domain


Now we need to verify our domain using this txt record. For that we have to add this txt record to our domain’s DNS settings. 

Please log in to your domain provider’s account and go to DNS settings. Then add a new txt record with the copied value from here. 

Different provider has different settings, but you should always find a section for updating DNS settings. If you are unable to find it, please contact your service provider. They will be able to help you adding the txt record.

For example, if your domain provider is Namecheap, then under domain settings, you can choose “Custom DNS” and then in Advanced DNS, there you can a add the txt record


 
After you have successfully added txt record, please go back to google search console’s tab we kept open and click verify

If things are good your site should be submitted successfully. 



Sometimes it fails to verify on first trial. Please try clicking the verify button multiple times in that case. 

Lets generate sitemap for our website


Sitemap is very important for finding and indexing your site in search engines. It can be called the index of all the required links which makes it convenient for search engine robots to understand the inner architecture of your website. You can call it as the roadmap of your website, which can help both the search engines or users to get the structure of the contents inside. So generating and submitting sitemap to search engines is very essential to generate more traffic.

Types of Sitemap 


There are generally 2 kinds of sitemaps you can find for the websites. They are: 

  1. HTML sitemaps
  2. XML sitemaps

Both of them have specific purpose and use actually. Lets explore their usage a bit: 

HTML sitemaps: Html sitemaps are primarily designed for human purpose and they hold mostly the important links of the websites. 

Mainly you should use HTML sitemaps when: 

  • You have large website with complex architecture and a lot of links 
  • Improve the overall site usability and accessibility 
  • You want your users to find specific content very quickly 

XML sitemaps: XML sitemaps are meant and built for search engines firstly. Search engines have their crawler to find a website's content and structure and these crawler use the XML sitemap of the website to achieve that. Thats why it is very important to have an updated XML sitemap in your application. This is typically an XML file which holds the records. (Step by step details are provided below on how to generate XML sitemap for your website) 

There are also different types of XML sitemaps: 

  • Image sitemap: If your website holds a lot images inside and you want index those in the search engine, you would have to generate a image sitemap to do so. It holds the list of image URLs and their metadata ( Such as title, description, location etc ) 
  • Video sitemap: Similar to Image sitemap, A video sitemap also lists the index of all the videos of your website and their metadata ( Title, description, Thumbnail, Length etc. ). You should use it when you have a  large number of video files. 
  • News sitemap: This one is less used today, but this category of sitemaps used to hold the information about new published articles. 
  • Mobile sitemap: Specifies mobile friendly pages for your website. But now they are actually less common. 

When you should use XML sitemap: 
  • You have a new website and you want to index your pages in the search engines.
  • For large website which holds many URLs as contents, but needs to identify, prioritize and index all the important contents first.
  • To improve discoverability in the dynamic website which holds deep linking. 
  • Websites which holds large volume of media data such as images or videos which should have a proper index to make them more accessible.

Steps to generate sitemap


Lets assume we have a working website with an active domain and we have added our domain to google search console. Please follow the steps above to do that perfectly.

There are several sites or online tool we can use to generate a sitemap. Some of those are free and others are paid. Free tools have some limitations but for regular purposes you can use them. Here we will try with an online tool called xml-sitemaps:


Please go to the site. Enter your website URL, in the more options, keep the settings as given to this screenshot. 



Now hit start, and after certain time, it will generate a sitemap. You can download the sitemap.xml file from there. 

Here are some other options you can try: 


Place the sitemap file to your site's root


After generating and downloading the sitemap.xml file, please place it in your website’s root directory. 

Your sitemap should accessible via your domain. For example, if your domain is https://www.example.com, then your sitemap URL should be like https://www.example.com/sitemap.xml 

So we have got a public URL in which we can access our newly generated sitemap. 


Generate dynamic sitemap in Laravel applications


In a Laravel application, its very easy to generate dynamic sitemap. In other words, a dynamic sitemap is always updated to it’s contents in the website, you dont have to regenerate it every time. Lets see a quick example how we can generate dynamic sitemap within our laravel application. 

Lets assume, we have a Laravel blog application where we have Posts table like below:

    • Posts
      • Id
      • Slug
      • Title
      • Description
      • Status 

Now we will try to generate a sitemap containing all the post links in it.

Steps to generate sitemap in Laravel


Lets start with route. Generally a domain’s sitemap is found under ‘your-domain/sitemap.xml’ URL. So lets add that route in web.php


        
Route::get('/sitemap.xml', 'SitemapController@index')->name('sitemap');

Create a new controller called SitemapController:


        
php artisan make:controller SitemapController

In the SitemapController, please add a view binding the posts data to it. Also pass a header Content-Type to set the content as xml.


            
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Models\Post;

class SitemapController extends Controller
{
    public function index()
    {
        $posts = Post::latest()->get();

        return response()->view('sitemap', [
            'posts' => $posts
        ])->header('Content-Type', 'text/xml');
    }
}

Now in the sitemap.blade.php under resources/views, please add the following code:


            
<?php echo '<?xml version="1.0" encoding="UTF-8"?>'; ?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
    @foreach ($posts as $post)
        <url>
            <loc>{{ url('/article/', $post->slug) }}</loc>
            <lastmod>{{ $post->created_at->tz('UTC')->toAtomString() }}</lastmod>
            <changefreq>daily</changefreq>
            <priority>0.9</priority>
        </url>
    @endforeach
</urlset>

Please note, here we are passing all the links of our posts in <loc> which refers to location
In the <lastmod>, we can provide last modification date. Though <lastmod>, <changefreq> and <priority> fields are optional

Run the server


Done, now we can run the server. Your sitemap should be available under your-domain/sitemap.xml


        
Php artisan serve

So thats how we can generate a dynamic sitemap with laravel application. No package or library is required, also you add other important URLs as required in the file. 

Add to Google Search Console



Select your property, you will see Sitemaps section in left sidebar. 

Click on it, you will see an field to add sitemap url. Add the url and submit. 

Done, you have successfully added sitemap to google search console.



Summary


Google search console is very mandatory tool which should be used for every website nowadays. Traffics, audiences and customers are the limelight of a website, and this tool helps to build growth with more traffics and enhance your business. Also when your website is ready, you should submit your sitemap and constantly update with latest URLs of your contents, so search engines can index those easily and show in relevant results. 

I Hope you have found this article useful. Please share your thoughts in the comment section or give a love to this article. 

I wish you a great day. 

Comments

Login As User

Shining_fgOi

4 months ago

Новейшие технологии от Shining 3D, для революционного применения в медицине и дизайне. 3D-сканирование: технология будущего от Shining 3D. Как 3D-принтеры от Shining 3D преобразуют промышленность. Shining 3D: лучшие инструменты для креативности и инноваций. Где купить продукцию Shining 3D в России. Shining 3D и перспективы применения 3D-сканирования. Shining 3D и перспективы развития 3D-печати. Как Shining 3D изменит принципы дизайна и архитектуры. 3D-сканирование и 3D-печать: новые возможности с Shining 3D. Shining 3D: технологии будущего уже здесь. shining 3d сканер [url=https://www.6hinin-tr.ru]https://www.6hinin-tr.ru[/url] .

Promyshlen_pxsl

4 months ago

Инженерные решения на основе 3D-сканирования промышленный 3д принтер купить [url=myshlennye-3d-ska4.ru]myshlennye-3d-ska4.ru[/url] .

lazernyy_ufmi

4 months ago

Лазерный 3D сканер: перспективы применения в различных отраслях лазерный сканер 3d цена [url=http://www.lazernyert4.ru/]http://www.lazernyert4.ru/[/url] .

profession_etma

4 months ago

Лучшие предложения на профессиональные 3D сканеры профессиональный 3d сканер [url=http://profes-3d-skan.ru/]http://profes-3d-skan.ru/[/url] .

Ruchnye_vuMi

4 months ago

Лучшие ручные 3D сканеры для промышленного применения 3d сканер ручной [url=chnye-3d-skan.ru]chnye-3d-skan.ru[/url] .

S M Morshed Hasan

1 month ago

good

Online_icki

1 week ago

Benefits of online schools in Washington, How online schools in Washington work, Tips for success in online schools in Washington, Contrasting different online schools in Washington, Key features of online schools in Washington, Budgeting for online schools in Washington, Finding accredited online schools in Washington, Obstacles to overcome in online schools in Washington, Resources for students in online schools in Washington, Job prospects for online school graduates in Washington, Training courses available at online schools in Washington, Flexible scheduling options at online schools in Washington, Creating a professional network at online schools in Washington, In-depth programs at online schools in Washington, Predictions for online schools in Washington, Tech essentials for online schools in Washington, Feedback from graduates of online schools in Washington, Steps to start at online schools in Washington, Benefits of online schools in Washington for adult learners Online Schools in Washington [url=http://www.onlineschoolwa2.com]http://www.onlineschoolwa2.com[/url] .

Online_vool

5 days ago

Explore top online schools in Oklahoma, with our detailed comparison. Learn about the benefits of attending an online school in Oklahoma. Start your search for the perfect online school in Oklahoma. Get real feedback from online students in Oklahoma. Online Schools in Oklahoma [url=https://www.onlineschoolok8.com/]https://www.onlineschoolok8.com/[/url] .

Online_vnSl

3 days ago

Top Online Schools in Kentucky, Discover Your Future, Achieve Your Goals, Start Your Journey Today, Comparison of Online vs Traditional Schools in Kentucky, Cost-Effective Online Schools in Kentucky, Invest in Your Future, Prepare for College, Online Elementary Schools in Kentucky, Understanding Online Education in Kentucky, A Closer Look at the Process Online Schools in Kentucky [url=http://onlineschoolky1.com]http://onlineschoolky1.com[/url] .

Word Count: 0