0
0
SEO Fundamentalsknowledge~30 mins

Mapping keywords to pages in SEO Fundamentals - Mini Project: Build & Apply

Choose your learning style9 modes available
Mapping Keywords to Pages
📖 Scenario: You are managing a website and want to organize which keywords should be linked to which pages. This helps search engines understand your site better and improves your site's search ranking.
🎯 Goal: Build a simple mapping of keywords to the pages they belong to, so you can easily see which keywords are targeted on each page.
📋 What You'll Learn
Create a dictionary called keyword_to_page with exact keyword-page pairs
Add a variable called default_page to assign a fallback page
Use a loop to create a new dictionary page_to_keywords that groups keywords by their pages
Add a final entry to page_to_keywords for the default_page with an empty list
💡 Why This Matters
🌍 Real World
Mapping keywords to pages helps organize website content for SEO, making it easier to optimize pages for search engines.
💼 Career
SEO specialists and web content managers use keyword-to-page mapping to improve website visibility and user navigation.
Progress0 / 4 steps
1
Create the keyword to page mapping
Create a dictionary called keyword_to_page with these exact entries: 'home': 'index.html', 'contact': 'contact.html', 'about': 'about.html', 'blog': 'blog.html', 'services': 'services.html'.
SEO Fundamentals
Need a hint?

Use curly braces {} to create a dictionary with the exact keyword and page pairs.

2
Add a default page variable
Add a variable called default_page and set it to the string 'index.html'.
SEO Fundamentals
Need a hint?

Just assign the string 'index.html' to the variable default_page.

3
Group keywords by their pages
Create an empty dictionary called page_to_keywords. Then use a for loop with variables keyword and page to iterate over keyword_to_page.items(). Inside the loop, add each keyword to the list of keywords for its page in page_to_keywords. If the page is not already a key, create a new list for it.
SEO Fundamentals
Need a hint?

Use a loop over keyword_to_page.items() and check if the page is already a key in page_to_keywords. If not, create an empty list. Then add the keyword to that list.

4
Add default page entry to the mapping
Add a new entry to page_to_keywords with the key as default_page and the value as an empty list [].
SEO Fundamentals
Need a hint?

Assign an empty list to the key default_page in page_to_keywords.