diff --git a/build.py b/build.py index 3d024bac..0345a22f 100644 --- a/build.py +++ b/build.py @@ -52,6 +52,15 @@ TOPICS = [ {"slug": "winter", "name": "Winter Dad Jokes", "emoji": "⛄", "intro": "These winter dad jokes are snow joke. Perfect for breaking the ice at any cold-weather gathering.", "keywords": r"\b(winter|snow|snowman|ic(y|icle)|frost|chill)\b"}, + {"slug": "school", "name": "Dad Jokes About School", "emoji": "\U0001F392", + "intro": "Class clown certified jokes for teachers, students, and anyone who survived homework. These school dad jokes will get you a passing grade in groans.", + "keywords": r"\b(school|teacher|class|student|homework|math|book|read|study)\b"}, + {"slug": "cars", "name": "Dad Jokes About Cars", "emoji": "\U0001F697", + "intro": "Drive everyone up the wall during your next road trip. These car dad jokes are strictly automatic when it comes to terrible punchlines.", + "keywords": r"\b(car|drive|road|truck|tire|wheel|traffic)\b"}, + {"slug": "ocean", "name": "Dad Jokes About the Ocean", "emoji": "\U0001F30A", + "intro": "Water you waiting for? Dive into these shore-fire maritime puns. These ocean dad jokes will make waves at any beach party.", + "keywords": r"\b(ocean|sea|beach|water|tides?|waves?|boat|ship|sail|sand|sharks?|fish)\b"}, ] MIN_TOPIC_JOKES = 5 @@ -311,7 +320,24 @@ def page_topic(slug): """ title = '%s — %d Clean, Groan-Worthy Jokes' % (t['name'], len(js)) desc = '%s %s' % (t['intro'], 'A curated collection of %d clean, family-friendly jokes.' % len(js)) - return layout(title, desc, body, '/topic/%s/' % slug) + + faq_ld = { + "@context": "https://schema.org", + "@type": "FAQPage", + "mainEntity": [ + { + "@type": "Question", + "name": j['setup'].replace('\n', ' '), + "acceptedAnswer": { + "@type": "Answer", + "text": j['punch'] + } + } for j in js + ] + } + + return layout(title, desc, body, '/topic/%s/' % slug, + '' % json.dumps(faq_ld).replace('