X

Important Notice:

It has come to our attention that some individuals, who are not affiliated with eGlobe IT Solutions, have been reaching out to job seekers falsely claiming to represent our company. These scammers are offering Work from Home Part-Time job opportunities under the guise of eGlobe IT Solutions and we have already reported to the concerned authorities under law. If you have been contacted by someone claiming to be from eGlobe IT Solutions via WhatsApp/Instagram/Facebook/SMS and you suspect that it might be a scam, we urge you to exercise caution. Do not share any personal information or make any financial transactions. Instead, pleasefollow these steps:

1. Contact Us:

If you have doubts or concerns, please reach out to our HR department directly at hr@eglobeits.com to confirm the authenticity of the communication.

2. Do Not Share Personal or Financial Information:

Under no circumstances should you share sensitive personal or financial information with anyone claiming to be from eGlobe IT Solutions without proper verification.

3. Report the Scam:

If you believe you have been targeted by a scam, please report it to your local law enforcement authorities and forward any suspicious emails or messages to us at hr@eglobeits.com so that we can take appropriate action.

Your safety and security are of paramount importance to us, and we take these matters very seriously. eGlobe IT Solutions is committed to maintaining the highest ethical standards in our recruitment processes.

Magento 2 Sitemap: How to Generate & Configure

Posted on: 10 Feb 2020 by Admin

In this tutorial you will learn how to configure sitemap in Magento 2 programmatically

what is a sitemap

A sitemap is a plain-text XML file that holds the link to all of the pages on your Magento store.
Once you add the links to the sitemap search engines can crawl your whole websites easily.

Therefore, it is important to keep the sitemap page updated as regularly as the content on your store changes.
Generating a Magento Sitemap also enhances the SEO of your online store.

Lets start how to configure sitemap in Magento 2 programmatically

In order to add custom URL to the Magento sitemap programmatically, you need to create a plugin for class Magento\Sitemap\Model\Sitemap.
Create an after plugin for collectSitemapItems() and add your custom URL to the collection.

Step 1 : Create di.xml in folder app/code/Egits/General/etc

<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

        xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">

    <type name="Magento\Sitemap\Model\Sitemap">

        <plugin name="add_new_url" sortOrder="1" disabled="false" type="Egits\General\Plugin\Model\SitemapPlugin"/>

    </type>

</config>

 

Here I used Egits as vendor_name and General as my module_name.
Step 2: Create a plugin class SitemapPlugin in folder app/code/Egits/General/Plugin/Model

helper = $helper;

    }

    /**

     * @param \Magento\Sitemap\Model\Sitemap $subject

     */

    public function afterCollectSitemapItems(\Magento\Sitemap\Model\Sitemap $subject)

    {

        $newItem = [];

        $storeId = $subject->getStoreId();

        $object = new \Magento\Framework\DataObject();

        $object->setId('unique_id');

        $object->setUrl('custom_url');

        $object->setUpdatedAt(date('Y-m-d h:i:s'));

        $newItem['unique_id'] = $object;

        $subject->addSitemapItem(new  \Magento\Framework\DataObject(

            [

                'changefreq' => $this->helper->getPageChangefreq($storeId),

                'priority' => $this->helper->getPagePriority($storeId),

                'collection' => $newItem,

            ]

        ));

        return;

    }

}

 

Then go to admin panel of your store and navigate to Marketing and click Sitemap under SEO & Search.

 

Under the Sitemap generator page, click on the Add Sitemap button on the right top corner if the sitemap is not yet added.
Fill the required fields such as File name and File Path.

 

Once it is done click the Generate link in the action column to generate the Magento sitemap.
Click on the Magento sitemap link to see the sitemap.

If the Magento sitemap page is already added then click the Generate button in the action column to complete the final step.

If you have followed the about instructions carefully then you have successfully added the URL to the sitemap in Magento 2.

Note: Hit the Magento 2 sitemap URL and ensure that your custom URL is added. As a Magento development company, we recommend you to keep your sitemap updated to improve your website ranking.

Well above you have read the process for sitemaping in Magento 2, then for making this process easiler please refer to the tutorial below.