Jump into concepts and practice - no test required
or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
URL Structure Optimization
📖 Scenario: You are managing a website for a local bakery. You want to organize the website URLs so that visitors and search engines can easily understand the content and navigate the site.
🎯 Goal: Build a clear and simple URL structure for the bakery website that groups pages logically and uses friendly words.
📋 What You'll Learn
Create a list of main website sections as URLs
Add a variable to hold the base domain
Combine the base domain with each section to form full URLs
Web developers and SEO specialists often design URL structures to make websites user-friendly and optimized for search engines.
Progress0 / 4 steps
1
Create the main website sections list
Create a list called sections with these exact entries: "about-us", "menu", "locations", "contact"
No-Code
Hint
Think of the main pages your bakery website needs and list them as simple words separated by commas inside square brackets.
2
Add the base domain variable
Create a variable called base_domain and set it to the string "https://www.localbakery.com"
No-Code
Hint
The base domain is the main website address. Store it as a string in a variable named base_domain.
3
Combine base domain with sections to form full URLs
Create a new list called full_urls that contains the full URLs by joining base_domain, a slash "/", and each section from sections using a list comprehension
No-Code
Hint
Use a list comprehension to join the base domain and each section with a slash between them.
4
Add the homepage URL
Create a variable called homepage_url and set it to the value of base_domain (the homepage URL is just the base domain without extra paths)
No-Code
Hint
The homepage URL is the main domain without any extra path. Just assign base_domain to homepage_url.
Practice
(1/5)
1. What is the main benefit of having a good URL structure for a website?
easy
A. It makes the links easy to read and remember.
B. It increases the website's loading speed.
C. It hides the website's content from users.
D. It automatically improves the website's design.
Solution
Step 1: Understand the purpose of URL structure
A good URL structure helps users and search engines understand the content of the page easily.
Step 2: Identify the main benefit
Making links easy to read and remember improves user experience and sharing.
Final Answer:
It makes the links easy to read and remember. -> Option A
Quick Check:
Good URL structure = Easy to read and remember [OK]
Hint: Good URLs are simple and memorable [OK]
Common Mistakes:
Confusing URL structure with website speed
Thinking URLs hide content
Believing URL affects design automatically
2. Which of the following is the correct way to write a URL path for a product category named "Summer Dresses"?
easy
A. /SummerDresses
B. /summer dresses
C. /summer_dresses
D. /summer-dresses
Solution
Step 1: Identify URL best practices for readability
Use lowercase letters and hyphens to separate words in URLs for clarity.
Step 2: Evaluate each option
/summer-dresses uses lowercase and hyphens, which is the recommended style.
Final Answer:
/summer-dresses -> Option D
Quick Check:
Lowercase + hyphens = Correct URL format [OK]
Hint: Use lowercase and hyphens for URL words [OK]
Common Mistakes:
Using uppercase letters in URLs
Using spaces instead of hyphens
Using underscores instead of hyphens
3. Given the URL https://example.com/electronics/phones/smartphones, what does this URL structure tell you about the page?
medium
A. It is a homepage for electronics.
B. It is a category page for smartphones under phones and electronics.
C. It is a product page for a specific smartphone.
D. It is a blog post about phones.
Solution
Step 1: Analyze the URL path segments
The URL path shows a hierarchy: electronics > phones > smartphones.
Step 2: Interpret the meaning of the hierarchy
This indicates a category page for smartphones, nested under phones and electronics categories.
Final Answer:
It is a category page for smartphones under phones and electronics. -> Option B
Quick Check:
URL hierarchy shows category nesting [OK]
Hint: URL path shows category levels from general to specific [OK]
Common Mistakes:
Assuming it's a product page without product ID
Confusing homepage with category page
Thinking it's a blog post without blog path
4. Identify the error in this URL structure: https://shop.com//clothing//men//jackets
medium
A. Spaces should be added between categories for clarity.
B. The URL should use uppercase letters for categories.
C. Double slashes should be avoided in URLs.
D. The domain name is incorrect.
Solution
Step 1: Examine the URL for structural issues
The URL contains double slashes between path segments, which is not standard.
Step 2: Understand URL best practices
URLs should have single slashes to separate path parts for proper interpretation by browsers and servers.
Final Answer:
Double slashes should be avoided in URLs. -> Option C
Quick Check:
Single slash separates URL parts [OK]
Hint: Use single slash between URL parts [OK]
Common Mistakes:
Using uppercase letters in URLs
Adding spaces in URLs
Misunderstanding domain name format
5. You want to create URLs for a blog with categories and subcategories like "Technology" and "Artificial Intelligence". Which URL structure is best for clarity and SEO?
hard
A. /technology/artificial-intelligence
B. /technology_artificialintelligence
C. /Technology/Artificial Intelligence
D. /technology/artificial_intelligence
Solution
Step 1: Review URL best practices for categories
Use lowercase letters and hyphens to separate words; use slashes to show hierarchy.
Step 2: Compare options for clarity and SEO
/technology/artificial-intelligence uses lowercase, hyphens for multi-word terms, and slashes for categories, which is clear and SEO-friendly.
Final Answer:
/technology/artificial-intelligence -> Option A
Quick Check:
Lowercase + hyphens + slashes = Best URL structure [OK]
Hint: Use lowercase, hyphens, and slashes for categories [OK]