0
0
SEO Fundamentalsknowledge~10 mins

XML sitemap creation in SEO Fundamentals - Step-by-Step Execution

Choose your learning style9 modes available
Concept Flow - XML sitemap creation
Start Sitemap Creation
List URLs to include
Create XML structure
Add <url> entries for each URL
Add <loc>, <lastmod>, <changefreq>, <priority> tags
Close XML tags
Save sitemap.xml file
Submit sitemap to search engines
The flow shows how to create an XML sitemap by listing URLs, building XML tags for each, and submitting the file.
Execution Sample
SEO Fundamentals
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://example.com/</loc>
  </url>
</urlset>
This XML snippet creates a sitemap with one URL entry for the homepage.
Analysis Table
StepActionXML Tag CreatedContent AddedResulting XML snippet
1Start XML document<?xml version="1.0" encoding="UTF-8"?>Declaration<?xml version="1.0" encoding="UTF-8"?>
2Open <urlset><urlset>xmlns attribute<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
3Add <url> entry<url>Start URL block<url>
4Add <loc><loc>https://example.com/<loc>https://example.com/</loc>
5Close <url></url>End URL block</url>
6Close <urlset></urlset>End sitemap</urlset>
💡 All URLs added and XML tags properly closed, sitemap creation complete.
State Tracker
VariableStartAfter Step 3After Step 4After Step 5Final
XML Content<?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <url><?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <url> <loc>https://example.com/</loc><?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <url> <loc>https://example.com/</loc> </url><?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <url> <loc>https://example.com/</loc> </url> </urlset>
Key Insights - 3 Insights
Why do we need the xmlns attribute in the <urlset> tag?
The xmlns attribute defines the XML namespace, telling search engines this file follows the sitemap protocol. Without it, the sitemap might not be recognized correctly (see execution_table step 2).
Can we add URLs without the <loc> tag inside <url>?
No, the <loc> tag is required to specify the exact URL. Omitting it means the URL entry is incomplete and ignored by search engines (see execution_table step 4).
What happens if we forget to close the <urlset> tag?
The XML becomes invalid and search engines will reject the sitemap. Proper closing of tags is essential for well-formed XML (see execution_table step 6).
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table at step 4, what content is added inside the <loc> tag?
Ahttps://example.com/home
Bhttp://example.com/
Chttps://example.com/
Dexample.com
💡 Hint
Check the 'Content Added' column at step 4 in execution_table.
At which step is the <url> tag closed in the execution_table?
AStep 4
BStep 5
CStep 3
DStep 6
💡 Hint
Look for the 'XML Tag Created' column showing a closing tag for .
If we add a second URL, how would the variable_tracker's 'XML Content' change after step 5?
AIt would include two <url> blocks before closing </urlset>
BIt would only have one <url> block
CIt would remove the first <url> block
DIt would close <urlset> early
💡 Hint
Refer to variable_tracker showing XML content growth with each URL added.
Concept Snapshot
XML Sitemap Creation:
- Start with XML declaration
- Open <urlset> with xmlns attribute
- Add one <url> block per URL
- Include <loc> tag with full URL
- Close all tags properly
- Save as sitemap.xml and submit to search engines
Full Transcript
Creating an XML sitemap involves starting with an XML declaration, opening the <urlset> tag with the required xmlns attribute, then adding a <url> block for each web page. Each <url> block must contain a <loc> tag specifying the full URL. After adding all URLs, close the <urlset> tag to complete the XML. This sitemap file helps search engines find and index your website pages efficiently.