0
0
SEO Fundamentalsknowledge~30 mins

Dynamic sitemap generation in SEO Fundamentals - Mini Project: Build & Apply

Choose your learning style9 modes available
Dynamic Sitemap Generation
📖 Scenario: You manage a website with many pages. To help search engines find all your pages, you want to create a sitemap that updates automatically when pages change.
🎯 Goal: Build a simple dynamic sitemap structure that lists website pages and updates when new pages are added.
📋 What You'll Learn
Create a list of website page URLs
Add a variable to hold the base website URL
Use a loop to generate full URLs for each page
Complete the sitemap structure with the correct XML tags
💡 Why This Matters
🌍 Real World
Websites use sitemaps to help search engines find and index all pages efficiently.
💼 Career
SEO specialists and web developers create dynamic sitemaps to improve website visibility and search ranking.
Progress0 / 4 steps
1
Create the list of website pages
Create a list called pages with these exact page paths: "/home", "/about", "/contact", "/blog", and "/products".
SEO Fundamentals
Need a hint?

Use square brackets to create a list and include all page paths as strings.

2
Add the base website URL
Create a variable called base_url and set it to the string "https://www.example.com".
SEO Fundamentals
Need a hint?

Assign the full website address as a string to base_url.

3
Generate full URLs for each page
Create a list called full_urls that contains the full URL for each page by combining base_url and each path in pages. Use a for loop with the variable page to do this.
SEO Fundamentals
Need a hint?

Start with an empty list, then add each full URL inside the loop.

4
Complete the sitemap XML structure
Create a string variable called sitemap_xml that starts with the XML declaration '' and the opening <urlset> tag. Then, add each URL inside <url> and <loc> tags using a for loop with variable url. Finally, close the </urlset> tag.
SEO Fundamentals
Need a hint?

Use string concatenation and f-strings to build the XML structure step by step.