File size: 7,382 Bytes
3af6d41
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
"""Source-backed view model for Coursera's current public home page."""

from __future__ import annotations

from pathlib import Path

from jinja2 import Environment, FileSystemLoader, select_autoescape

from home_inventory import load_home_inventory


TEMPLATE_ROOT = Path(__file__).resolve().parent / "templates"
_TEMPLATES = Environment(
    loader=FileSystemLoader(TEMPLATE_ROOT),
    autoescape=select_autoescape(("html", "xml")),
)

PROMOS = (
    {
        "key": "learn-without-limits",
        "art": "coursera-plus",
        "image": "/static/home/current-promo-plus-landscape.png",
        "href": "/signup",
        "eyebrow": "Coursera",
        "title": "Learn without limits",
        "subtitle": "Learn online and earn valuable credentials from top universities, like Yale, Michigan, and Google.",
        "cta": "Join for free",
        "features": ("7-day free trial", "Learn at your own pace", "Certificates of completion"),
        "tone": "light",
    },
    {
        "key": "coursera-plus",
        "image": "/static/home/current-promo-plus.png",
        "href": "/courseraplus/special/cplus-monthly-august-2026-global",
        "eyebrow": "Coursera Plus",
        "title": "Save 40% on 3 months of Coursera Plus",
        "subtitle": "Get unlimited access to 10,000+ learning programs from world-class universities and companies.",
        "cta": "Start 7-day free trial",
        "features": ("10,000+ courses and certificates", "Learn at your own pace", "Cancel anytime"),
        "tone": "blue",
    },
    {
        "key": "for-business",
        "image": "/static/home/current-promo-teams.png",
        "href": "/business/teams",
        "eyebrow": "For Business",
        "title": "Close team skill gaps for what's next",
        "subtitle": "Empower your team with the skills to keep your organization moving forward.",
        "cta": "Explore Coursera for Business",
        "features": ("Upskill your whole team", "Track learner progress", "Flexible team plans"),
        "tone": "light",
    },
    {
        "key": "career",
        "image": "/static/home/current-promo-career.png",
        "href": "/signup",
        "eyebrow": "For Individuals",
        "title": "Start, switch, or advance your career.",
        "subtitle": "Find the right course or certificate to build the career you want.",
        "cta": "Explore career paths",
        "features": ("Beginner to advanced", "Job-relevant skills", "Certificates of completion"),
        "tone": "warm",
    },
)

PARTNERS = (
    ("Google", "/static/home/logo-google.avif", "/google-career-certificates"),
    ("IBM", "/static/home/logo-ibm.avif", "/explore/ibm-online-courses"),
    ("Microsoft", "/static/home/logo-microsoft.avif", "/explore/microsoft-certificates"),
    ("University of Illinois", "/static/home/logo-illinois.avif", "/partners/illinois"),
    ("OpenAI", "/static/home/logo-openai.avif", "/partners/openai"),
    ("Anthropic", "/static/home/logo-anthropic.avif", "/partners/anthropic"),
    ("DeepLearning.AI", "/static/home/logo-deeplearning-ai.avif", "/explore/deep-learning-ai-online-courses"),
    ("Stanford University", "/static/home/logo-stanford.avif", "/explore/stanford-online-courses"),
    ("University of Pennsylvania", "/static/home/logo-penn.avif", "/explore/university-of-pennsylvania-online-courses"),
    ("University of Michigan", "/static/home/logo-michigan.avif", "/explore/university-of-michigan-online-courses"),
)

CATEGORIES = (
    ("Business", "/browse/business"),
    ("Artificial Intelligence", "/explore/generative-ai"),
    ("Generative AI", "/courses?query=generative%20ai"),
    ("English speaking", "/courses?query=english"),
    ("Data Science", "/browse/data-science"),
    ("Computer Science", "/browse/computer-science"),
    ("Information Technology", "/browse/information-technology"),
    ("Personal Development", "/browse/personal-development"),
    ("Healthcare", "/browse/health"),
    ("Language Learning", "/browse/language-learning"),
    ("Social Sciences", "/browse/social-sciences"),
    ("Arts and Humanities", "/browse/arts-and-humanities"),
    ("Physical Science and Engineering", "/browse/physical-science-and-engineering"),
    ("Math and Logic", "/browse/math-and-logic"),
)

PURPOSES = (
    ("Start my career", "/search?query=Start%20my%20career"),
    ("Change my career", "/search?query=Change%20my%20career"),
    ("Grow in my current role", "/search?query=Grow%20in%20my%20current%20role"),
    ("Explore topics outside of work", "/browse"),
)

LEARNERS = (
    ("Sarah W.", "/static/home/learner-sarah.avif", "Coursera's reputation for high-quality content, paired with its flexible structure, made it possible for me to dive into data analytics while managing everyday life."),
    ("Noeris B.", "/static/home/learner-noeris.avif", "Coursera rebuilt my confidence and showed me I could dream bigger. It wasn't just about gaining knowledge—it was about believing in my potential again."),
    ("Abdullahi M.", "/static/home/learner-abdullahi.avif", "I now feel more prepared to take on leadership roles and have already started mentoring some of my colleagues."),
    ("Anas A.", "/static/home/learner-anas.avif", "Learning with Coursera has expanded my professional expertise by giving me access to cutting-edge research, practical tools, and global perspectives."),
)

AI_COLLECTIONS = (
    ("get-started", "Get Started", "ai-skills"),
    ("bestsellers", "Bestsellers", "most-popular"),
    ("tools", "Tools", "career-data"),
    ("advanced", "Advanced", "google-career"),
    ("agentic-ai", "Agentic AI", "trending-ai-courses"),
    ("resume-builder", "Resume Builder", "trending-project-management"),
)

CAREER_COLLECTIONS = (
    ("data", "Data", "career-data"),
    ("business", "Business", "most-popular"),
    ("sales-marketing", "Sales & Marketing", "trending-project-management"),
    ("it", "IT", "google-career"),
    ("software-engineering", "Software Engineering", "ai-skills"),
)

FAQS = (
    "Is Coursera accredited, and are Coursera certificates recognized by employers?",
    "Is a Coursera certificate worth it?",
    "What is Coursera Plus, and is it worth it?",
    "Does Coursera offer free online courses?",
    "What are the most popular courses on Coursera?",
    "How can Coursera help me get a job or advance my career?",
    "What is Coursera for Business, and how much does it cost?",
)


def render_home_body() -> str:
    sections = {section.section_id: section for section in load_home_inventory()}
    return _TEMPLATES.get_template("pages/home.html").render(
        promos=PROMOS,
        partners=PARTNERS,
        categories=CATEGORIES,
        purposes=PURPOSES,
        learners=LEARNERS,
        popular_sections=(sections["most-popular"], sections["hot-new-releases"], sections["trending-ai-courses"]),
        career_collections=tuple(
            (key, label, sections[section_id])
            for key, label, section_id in CAREER_COLLECTIONS
        ),
        google_section=sections["google-career"],
        trending_sections=(sections["trending-python"], sections["trending-data-analytics"], sections["trending-project-management"]),
        ai_collections=tuple(
            (key, label, sections[section_id])
            for key, label, section_id in AI_COLLECTIONS
        ),
        roles_section=sections["explore-careers"],
        faqs=FAQS,
    )