0
0
SEO Fundamentalsknowledge~30 mins

Template-based page generation in SEO Fundamentals - Mini Project: Build & Apply

Choose your learning style9 modes available
Template-based page generation
📖 Scenario: You work for a small online bookstore. You want to create web pages for each book using a simple template that fills in the book's title, author, and price.
🎯 Goal: Build a basic template-based page generation system that uses placeholders and fills them with book data to create personalized book pages.
📋 What You'll Learn
Create a dictionary called book with keys title, author, and price with exact values
Create a string variable called template that contains placeholders for title, author, and price
Use a method to replace the placeholders in template with the values from book
Store the final generated page in a variable called page
💡 Why This Matters
🌍 Real World
Template-based page generation is used in websites to create many similar pages quickly by filling templates with different data.
💼 Career
Web developers and content managers use template systems to efficiently build and maintain websites with dynamic content.
Progress0 / 4 steps
1
Create the book data dictionary
Create a dictionary called book with these exact entries: 'title': 'The Great Gatsby', 'author': 'F. Scott Fitzgerald', and 'price': '$10.99'.
SEO Fundamentals
Need a hint?

Use curly braces {} to create a dictionary with keys and values.

2
Create the HTML template string
Create a string variable called template that contains this exact HTML with placeholders: <h1>{title}</h1><p>Author: {author}</p><p>Price: {price}</p>.
SEO Fundamentals
Need a hint?

Use a string with curly braces {} as placeholders for the book data.

3
Fill the template with book data
Use the format method on template with the book dictionary to create a new string called page that has the placeholders replaced by the actual book values.
SEO Fundamentals
Need a hint?

Use template.format(**book) to fill in the placeholders with dictionary values.

4
Complete the page generation
Ensure the variable page contains the final HTML string with the book's title, author, and price filled in using the template.
SEO Fundamentals
Need a hint?

The page variable already holds the final HTML string after formatting.