#!/usr/bin/env python3
"""Static site generator for bestdadjokes.lol. Python 3.6 stdlib only."""
import json, os, re, shutil, html, datetime
ROOT = os.path.dirname(os.path.abspath(__file__))
CONTENT = os.path.join(ROOT, 'content', 'jokes.json')
SITE_DIR = os.path.join(ROOT, 'site')
STATIC = os.path.join(ROOT, 'static')
SITE_URL = 'https://bestdadjokes.lol'
SITE_NAME = 'Best Dad Jokes'
TAGLINE = 'The best dad jokes on the internet โ short, clean, and groan-worthy.'
YEAR = datetime.date.today().year
with open(CONTENT) as f:
DATA = json.load(f)
CATS = DATA['categories']
JOKES = DATA['jokes']
CAT_BY_SLUG = {c['slug']: c for c in CATS}
for i, j in enumerate(JOKES):
j['id'] = i
# Long-tail topic pages: jokes matched by keyword across all categories.
TOPICS = [
{"slug": "coffee", "name": "Dad Jokes About Coffee", "emoji": "โ",
"intro": "Fuel for dads and their worst puns alike. These coffee dad jokes are best served strong, black, and with a healthy amount of eye-rolling.",
"keywords": r"\b(coffee|espresso|latte|caffeine|beans?|mugs?)\b"},
{"slug": "cats", "name": "Dad Jokes About Cats", "emoji": "๐ฑ",
"intro": "For the cat dads out there. These cat dad jokes will make your feline walk out of the room in disgust โ which, for a cat, is a standing ovation.",
"keywords": r"\b(cats?|kittens?|purr|feline|meow)\b"},
{"slug": "dogs", "name": "Dad Jokes About Dogs", "emoji": "๐",
"intro": "A dog is the only audience that wags at dad jokes. Fetch! These dog dad jokes are good boys, every one of them.",
"keywords": r"\b(dogs?|puppy|puppies|pup|hound)\b"},
{"slug": "cows", "name": "Dad Jokes About Cows", "emoji": "๐",
"intro": "Outstanding in their field and in our pun archive. These cow dad jokes are udderly relentless.",
"keywords": r"\b(cows?|cattle|moo|udder|beef|herd)\b"},
{"slug": "dad-jokes-about-fishing", "name": "Dad Jokes About Fishing", "emoji": "๐ฃ",
"intro": "Reel in the groans with these clean fishing dad jokes. Hook, line, and sinker comedy for anglers and lake trips.",
"keywords": r"\b(fish|fishing|angler|anglers|trout|salmon|bass|goldfish|sofishticated|stream|bait|tackle|reel|reeling|fisherman|fishermen|carp|catch|lake|rod)\b"},
{"slug": "pizza", "name": "Dad Jokes About Pizza", "emoji": "๐",
"intro": "A slice of comedy gold. These pizza dad jokes are cheesy by design โ that's not a bug, it's the whole point.",
"keywords": r"\b(pizza|pizzas|cheese|cheesy|crust|pepperoni|slice|slices|mozzarella)\b"},
{"slug": "money", "name": "Dad Jokes About Money", "emoji": "๐ฐ",
"intro": "Money can't buy happiness, but it can buy these money dad jokes, which are basically the same thing but cheaper.",
"keywords": r"\b(money|cash|coins?|dollars?|penn(y|ies)|bank|rich|spen[dt]|salary)\b"},
{"slug": "sleep", "name": "Dad Jokes About Sleep", "emoji": "๐ด",
"intro": "Read these sleep dad jokes in bed. Groaning yourself to sleep counts as a lullaby.",
"keywords": r"\b(sleep|nap|bed|pillow|blanket|tired|asleep|dream)\b"},
{"slug": "love", "name": "Dad Jokes About Love", "emoji": "โค๏ธ",
"intro": "Romance, dad-style. These love dad jokes have walked someone down the aisle against their will and lived to pun about it.",
"keywords": r"\b(love|romantic|valentine|marri(ed|age)|attract|wife|husband|buoy)\b"},
{"slug": "birthday", "name": "Birthday Dad Jokes", "emoji": "๐",
"intro": "Because every birthday needs at least one groan with the cake. These birthday dad jokes are tradition now, sorry.",
"keywords": r"\b(birthday|cake|candles?|party|presents?)\b"},
{"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": "๐",
"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": "teacher", "name": "Dad Jokes About Teachers", "emoji": "๐",
"intro": "Grade A puns that will get you sent to the principal's office. These teacher dad jokes are strictly for extra credit.",
"keywords": r"\b(teacher|teachers|teach|principal)\b"},
{"slug": "computer", "name": "Dad Jokes About Computers", "emoji": "๐ป",
"intro": "Hard drive full of jokes? Boot up these tech puns. These computer dad jokes are guaranteed to crash your family dinner.",
"keywords": r"\b(computer|computers|laptop|pc|keyboard|mouse)\b"},
{"slug": "snowman", "name": "Dad Jokes About Snowmen", "emoji": "โ๏ธ",
"intro": "Frosty reception guaranteed. These snowman dad jokes are stone cold classics that will melt your heart (and your patience).",
"keywords": r"\b(snowman|snowmen|frosty)\b"},
{"slug": "ocean", "name": "Dad Jokes About the Ocean", "emoji": "๐",
"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"},
{"slug": "moon", "name": "Dad Jokes About the Moon", "emoji": "๐",
"intro": "These jokes are out of this world! Get ready for some stellar dad jokes about the moon.",
"keywords": r"\b(moon|space|stars?|planet)\b"},
{"slug": "vacation", "name": "Dad Jokes About Vacation", "emoji": "๐๏ธ",
"intro": "Time to pack your bags and your best puns! These dad jokes about vacation will have you laughing all the way to your destination.",
"keywords": r"\b(vacation|trip|travel|holiday|packing)\b"},
{"slug": "food", "name": "Dad Jokes About Food", "emoji": "๐",
"intro": "Hungry for a laugh? These dad jokes about food will hit the spot.",
"keywords": r"\b(food|eat|dinner|lunch|breakfast|hungry|pizza|coffee|cheese|lettuce)\b"},
{"slug": "animals", "name": "Dad Jokes About Animals", "emoji": "๐",
"intro": "Lions, tigers, and puns - oh my! Enjoy these wild dad jokes about animals.",
"keywords": r"\b(animal|animals|dog|cat|fish|bird|bear|horse|cows?|deer)\b"},
{"slug": "music", "name": "Dad Jokes About Music", "emoji": "๐ต",
"intro": "Strike a chord with these dad jokes about music. They are sure to be a hit.",
"keywords": r"\b(music|song|sing|band|guitar|piano|drum|notes?)\b"},
{"slug": "clothing", "name": "Dad Jokes About Clothing", "emoji": "๐",
"intro": "You will look stylish telling these dad jokes about clothing.",
"keywords": r"\b(clothes|shirt|pants|shoes|hat|wear|socks?|tie|suit)\b"},
{"slug": "space", "name": "Dad Jokes About Space", "emoji": "๐",
"intro": "These space dad jokes are out of this world.",
"keywords": r"\b(space|astronauts?|planets?|moon|sun|stars|aliens?)\b"},
{"slug": "halloween-dad-jokes", "name": "Halloween Dad Jokes", "emoji": "๐",
"intro": "The best clean Halloween dad jokes, spooky puns, and skeleton one-liners. Groan-worthy laughs for trick-or-treaters, kids, and family parties.",
"keywords": r"\b(halloween|ghost|skeleton|pumpkin|spooky|vampire|zombie|witch|monster|bat|dracula|frankenstein|ghoul)\b"},
{"slug": "thanksgiving-dad-jokes", "name": "Thanksgiving Dad Jokes", "emoji": "๐ฆ",
"intro": "Feast on the funniest Thanksgiving dad jokes! Clean turkey puns, dinner table groaners, and autumn laughs guaranteed to make the family roll their eyes.",
"keywords": r"\b(thanksgiving|turkey|turkeys|pilgrim|pilgrims|cranberr\w*|stuffing|gravy|feast|yam|yams)\b"},
{"slug": "christmas-dad-jokes", "name": "Christmas Dad Jokes", "emoji": "๐",
"intro": "Spread holiday cheer with the best Christmas dad jokes, Santa puns, and clean holiday one-liners. Perfect for Christmas cards and family gatherings.",
"keywords": r"\b(christmas|santa|elf|reindeer|snow|winter|tree|present|holiday|sleigh|snowman)\b"},
{"slug": "dad-jokes-for-kids", "name": "Dad Jokes for Kids", "emoji": "๐ง",
"intro": "Over 50 hilarious, 100% clean dad jokes for kids, students, and teachers. School-safe puns and corny one-liners that the whole family will love.",
"keywords": r"\b(kid|child|children|school|teacher|student|boy|girl|math|science|homework|play|game)\b"},
{"slug": "work-dad-jokes", "name": "Work Dad Jokes", "emoji": "๐ข",
"intro": "Break the ice at your next meeting with clean office dad jokes. Workplace-safe humor, corporate puns, and harmless water cooler groaners.",
"keywords": r"\b(work|office|job|boss|meeting|employee|coworker|business|company|career)\b"},
{"slug": "software-engineers", "name": "Dad Jokes About Software Engineers", "emoji": "๐ป",
"intro": "Did you hear about the programmer who got locked out of their house? They lost their keys! These software engineer dad jokes are fully debugged and ready to compile into instant groans.",
"keywords": r"\b(software|engineer|engineers|code|coding|programmer|programmers|dev|developer|developers|debug|debugging|python|java|javascript|html|cache|server|servers|database|sql|hardware|udp|hobbyte|git)\b"},
{"slug": "clean-dad-jokes-for-5-year-olds", "name": "Clean Dad Jokes for 5 Year Olds", "emoji": "๐ง",
"intro": "Why did the toddler cross the playground? To get to the other slide! These clean dad jokes for 5-year-olds are kindergarten-approved and perfectly tailored for the juice-box crowd.",
"keywords": r"\b(clean|kid|kids|child|kindergarten|toddler|preschool|toy|toys|five|5|playground|sandbox|nursery)\b"},
{"slug": "dad-jokes-for-fathers-day", "name": "Dad Jokes for Father's Day", "emoji": "๐",
"intro": "Honor the undisputed king of groans with hilarious Father's Day dad jokes and parenting puns that celebrate all things dad.",
"keywords": r"\b(father|fathers|dad|dads|parent|parents|daddy|pop|papa|father's day)\b"},
{"slug": "dad-jokes-about-books", "name": "Dad Jokes About Books", "emoji": "๐",
"intro": "Check out these novel dad jokes about books, libraries, and reading. Bound to get a solid chuckle from bookworms and librarians.",
"keywords": r"\b(book|books|novel|novels|author|authors|library|libraries|librarian|librarians|reading|read|chapter|chapters|thesaurus|dictionary|overbooked|anti-gravity)\b"},
{"slug": "dad-jokes-about-gardening", "name": "Dad Jokes About Gardening", "emoji": "๐ฑ",
"intro": "Plant a smile with garden dad jokes, tree puns, and flora humor that will grow on you in no time.",
"keywords": r"\b(garden|gardens|gardening|gardener|plant|plants|tree|trees|flower|flowers|lawn|weed|soil|bud|seeds?|bark|branch|leaf|leaves)\b"},
{"slug": "dad-jokes-about-baseball", "name": "Dad Jokes About Baseball", "emoji": "โพ",
"intro": "Step up to the plate with these hilarious baseball dad jokes. They will knock your socks off or strike you out laughing.",
"keywords": r"\b(baseball|batter|batters|pitcher|pitchers|home run|stole second|dugout|catcher|baseball player|baseball players)\b"},
{"slug": "dad-jokes-about-golf", "name": "Dad Jokes About Golf", "emoji": "โณ",
"intro": "Tee off with clean golf dad jokes that are guaranteed to stay out of the rough and score a hole-in-one groan.",
"keywords": r"\b(golf|golfer|golfers|golfing|hole in one|birdie|fairway|par|putt|putting|green)\b"},
{"slug": "dad-jokes-for-road-trips", "name": "Dad Jokes for Road Trips", "emoji": "๐",
"intro": "Are we there yet? Fuel up family travel with hilarious road trip dad jokes, car puns, and highway humor.",
"keywords": r"\b(road|trip|car|cars|drive|driving|traffic|miles|highway|travel|vacation|wheels?|tires?|gps|map|van|truck)\b"},
{"slug": "math-dad-jokes", "name": "Dad Jokes About Math", "emoji": "๐",
"intro": "Why was the geometry book so adorable? It had acute angles! These clean math dad jokes and number puns are 100% calculated to multiply groans and divide boredom.",
"keywords": r"\b(math|triangle|geometry|angle|acute|algebra|fraction|calculator|times square)\b"},
{"slug": "doctor-dad-jokes", "name": "Dad Jokes About Doctors", "emoji": "๐ฉบ",
"intro": "Why did the banana go to the doctor? It wasn't peeling well! These hilarious doctor, dentist, and medical dad jokes are just what the physician ordered for instant laughs.",
"keywords": r"\b(doctor|physicians?|dentists?|hospitals?|nurses?|stethoscope|surgeons?|filling|checkup|clinic|medicine|prescription|broken arm|patients?)\b"},
{"slug": "cross-the-road-jokes", "name": "Why Did the Chicken Cross the Road Jokes", "emoji": "๐",
"intro": "Why did the turtle cross the road? To get to the shell station! Explore the best groan-worthy twists on the classic 'Why did the chicken cross the road?' punchline.",
"keywords": r"\b(cross(?:ed|ing)?\s+(?:the\s+)?road|other\s+side|other\s+slide|shell\s+station|barking\s+lot|udder\s+side)\b"},
{"slug": "eyes", "name": "Dad Jokes About Eyes", "emoji": "๐",
"intro": "Eye see what you did there! These dad jokes about eyes are a sight for sore... well, you know.",
"keywords": r"\b(eyes?|see|sight|glasses|vision)\b"},
{"slug": "dad-jokes-about-history", "name": "Dad Jokes About History", "emoji": "๐๏ธ",
"intro": "Why did Rudolph get a bad report card? Because he went down in history! Travel back in time with ancient Roman puns, medieval laughs, and historic dad jokes that will never go out of style.",
"keywords": r"\b(history|historical|ancient|rome|roman|romans|caesar|pharaoh|pyramid|pyramids|medieval|knight|knights|castle|king|queen|revolution|napoleon|gladiator)\b"},
{"slug": "dad-jokes-about-airplanes", "name": "Dad Jokes About Airplanes", "emoji": "โ๏ธ",
"intro": "Why did the airplane get sent to its room? For bad altitude! Fasten your seatbelts for first-class aviation dad jokes, pilot puns, and high-flying humor that never crash.",
"keywords": r"\b(plane|planes|airplane|airplanes|pilot|pilots|airport|cabin|propeller|jet|runway|altitude|boarding)\b"},
{"slug": "dad-jokes-about-cooking", "name": "Dad Jokes About Cooking & Baking", "emoji": "๐ณ",
"intro": "Looking for appetizing humor? Whip up some laughter with these clean cooking dad jokes, kitchen puns, and bakery groaners.",
"keywords": r"\b(cook|cooking|chef|chefs|bake|baker|bakers|bakery|kitchen|recipe|dough|yeast|sauce|pan|pasta|spaghetti|skillet)\b"},
{"slug": "dad-jokes-about-trees", "name": "Dad Jokes About Trees & Nature", "emoji": "๐ฒ",
"intro": "Branch out into arbor humor! These clean tree dad jokes, forest puns, and leafy one-liners will root you to the spot.",
"keywords": r"\b(trees?|branch|branches|leaf|leaves|bark|trunk|root|roots|acorn|forest|oak|pine|wood)\b"},
{"slug": "dad-jokes-about-birds", "name": "Dad Jokes About Birds", "emoji": "๐ฆ",
"intro": "Flock together for bird dad jokes and feathered puns that will take flight at your next family gathering.",
"keywords": r"\b(birds?|seagulls?|duck|ducks|owl|owls|penguin|penguins|crow|crows|feathers?|wings?|flying|quack|nest|pigeon)\b"},
{"slug": "dad-jokes-about-construction", "name": "Dad Jokes About Construction & Tools", "emoji": "๐จ",
"intro": "Nailed it! Build up the laughs with hilarious construction dad jokes, carpenter puns, and heavy-duty tool humor.",
"keywords": r"\b(construction|hammer|nail|nails|tool|tools|saw|screw|screwdriver|drill|wrench|brick|bricks|builder|plumber|plumbing|ladder)\b"},
{"slug": "dad-jokes-for-breakfast", "name": "Dad Jokes About Breakfast", "emoji": "๐ฅ",
"intro": "Start your morning with an egg-cellent laugh. Sunny-side-up breakfast dad jokes, coffee puns, and pancake groaners.",
"keywords": r"\b(breakfast|coffee|cereal|egg|eggs|toast|pancake|pancakes|waffle|waffles|bacon|morning|tea)\b"},
{"slug": "dad-jokes-about-clocks", "name": "Dad Jokes About Clocks & Time", "emoji": "โฐ",
"intro": "It's about time! Watch out for these clean clock dad jokes, watchmaker puns, and timeless family-friendly groaners.",
"keywords": r"\b(clocks?|watch|watches|watchmaker|hourglass|alarm|time|tock|ticking|seconds?|minutes?|hours?|calendar|pendulum)\b"},
{"slug": "dad-jokes-about-science", "name": "Dad Jokes About Science & Chemistry", "emoji": "๐ฌ",
"intro": "Tested and approved by the funniest minds in the lab. Clean science dad jokes, physics puns, and periodic groaners.",
"keywords": r"\b(science|scientist|scientists|atom|atoms|physics|chemistry|chemist|biology|microscope|beaker|laboratory|gravity)\b"}
]
MIN_TOPIC_JOKES = 5
def esc(s):
return html.escape(s, quote=True)
def joke_count(slug):
return sum(1 for j in JOKES if j['cat'] == slug)
def json_ld_script(obj):
"""Serialize structured data cleanly without HTML escaping quotes."""
return '' % json.dumps(obj, ensure_ascii=False).replace('', r'<\/')
def joke_card(j, reveal=False):
"""A single joke card. Punchline is in the DOM (SEO-safe); JS blurs until clicked."""
cls = 'joke-card'
if j.get('type') == 'knock':
body = '
%s
' % esc(j['setup']).replace('\n', ' ')
else:
body = '
%s
' % esc(j['setup'])
punch = '
%s
' % esc(j['punch'])
share = (''
'' % (j['id'], j['id']))
return ('%s%s'
'%s'
% (cls, j['id'], body, punch, share))
def layout(title, desc, body, path='/', extra_head=''):
if len(desc) > 155:
desc = desc[:154] + 'โฆ'
nav_cats = ''.join(
'%s %s' % (c['slug'], c['emoji'], esc(c['name']))
for c in CATS)
foot_cats = ''.join('%s' % (c['slug'], esc(c['name'])) for c in CATS)
live_topics_nav = [t for t in TOPICS if len(topic_jokes(t)) >= MIN_TOPIC_JOKES]
foot_topics = ''.join('%s' % (t['slug'], esc(t['name'])) for t in live_topics_nav[:16])
return f"""
{esc(title)}
{extra_head}
{body}
"""
# --- BLOG & CURATED LIST ARTICLES ---
BLOG_ARTICLES = [
{
"slug": "thanksgiving-dad-jokes-that-will-make-the-table-groan",
"title": "12 Thanksgiving Dad Jokes That Will Make the Whole Table Groan",
"desc": "The ultimate list of 100% clean Thanksgiving dad jokes, turkey puns, and dinner table groaners guaranteed to make your family roll their eyes.",
"date": "2026-10-01",
"author": "Best Dad Jokes Team",
"emoji": "๐ฆ",
"intro": "Thanksgiving dinner is all about family, gratitude, second helpings of mashed potatoes, and of courseโinflicting the corniest holiday puns possible upon unsuspecting relatives. Whether you need a witty one-liner to break the ice during awkward small talk or a quick pun before carving the bird, here are 12 hand-picked Thanksgiving dad jokes that will make the entire table groan in delight.",
"topic_link": "/topic/thanksgiving-dad-jokes/",
"topic_name": "Thanksgiving Dad Jokes topic cluster",
"jokes": [
{"setup": "Why didn't the turkey finish its dessert?", "punch": "Because it was already stuffed."},
{"setup": "Why did the cranberries turn red?", "punch": "Because they saw the turkey dressing."},
{"setup": "What kind of music did the Pilgrims like?", "punch": "Plymouth Rock."},
{"setup": "What do turkeys wear to formal occasions?", "punch": "Gravy-ties."},
{"setup": "What's a turkey's favorite dessert?", "punch": "Peach gobbler."},
{"setup": "Why did the police arrest the turkey?", "punch": "They suspected foul play."},
{"setup": "What did the mother turkey say to her disobedient children?", "punch": "If your father could see you now, he'd turn over in his gravy!"},
{"setup": "What happens when you step on a grape at Thanksgiving?", "punch": "It lets out a little wine."},
{"setup": "What do you call a stuffed animal?", "punch": "You after Thanksgiving dinner."},
{"setup": "What side of the turkey has the most feathers?", "punch": "The outside."},
{"setup": "What sound does a space turkey make?", "punch": "Hubble, hubble, hubble."},
{"setup": "Why do pilgrims' pants always fall down?", "punch": "Because they wear their belt buckles on their hats!"}
]
},
{
"slug": "clean-halloween-dad-jokes-for-kids-and-trick-or-treaters",
"title": "15 Clean Halloween Dad Jokes for Kids & Trick-or-Treaters",
"desc": "Spooky, silly, and 100% kid-safe! These clean Halloween dad jokes and skeleton puns are perfect for classroom parties and trick-or-treat laughs.",
"date": "2026-10-01",
"author": "Best Dad Jokes Team",
"emoji": "๐",
"intro": "Halloween should be full of treats, not tricky innuendos. If you're a parent packing a spooky lunchbox note, an elementary teacher looking for a classroom icebreaker, or just a dad greeting trick-or-treaters at the front door, here are 15 clean, hilarious Halloween dad jokes that offer maximum laughs with zero fright.",
"topic_link": "/topic/halloween-dad-jokes/",
"topic_name": "Halloween Dad Jokes collection",
"jokes": [
{"setup": "Why don't skeletons ever fight each other?", "punch": "They don't have the guts."},
{"setup": "What do you call a witch's garage?", "punch": "A broom closet."},
{"setup": "Why did the vampire subscribe to the newspaper?", "punch": "He heard it had great circulation."},
{"setup": "What's a ghost's favorite dessert?", "punch": "I scream."},
{"setup": "Why don't mummies take vacations?", "punch": "They're afraid to unwind."},
{"setup": "What do you call a monster who poisons corn flakes?", "punch": "A cereal killer."},
{"setup": "Why are ghosts such bad liars?", "punch": "You can see right through them."},
{"setup": "What do you get when you cross a snowman with a vampire?", "punch": "Frostbite."},
{"setup": "Why did the skeleton go to the party alone?", "punch": "He had no body to go with him."},
{"setup": "What kind of music do mummies listen to?", "punch": "Wrap music."},
{"setup": "What did the skeleton order at the restaurant?", "punch": "Spare ribs."},
{"setup": "Why do witches ride brooms?", "punch": "Vacuum cleaners are too expensive."},
{"setup": "What do you call a haunted chicken?", "punch": "A poultry-geist."},
{"setup": "Why did the ghost go to the bar?", "punch": "For the boos."},
{"setup": "How do you make a skeleton laugh?", "punch": "Tickle its funny bone."}
]
},
{
"slug": "best-dad-jokes-for-kids-school-safe-puns",
"title": "15 Best Dad Jokes for Kids (School-Safe Puns & Groaners)",
"desc": "Looking for clean, school-safe dad jokes for kids? Here are 15 hilarious, family-friendly puns tested and approved by groaners everywhere.",
"date": "2026-10-01",
"author": "Best Dad Jokes Team",
"emoji": "๐",
"intro": "Kids love dad jokes because they are short, silly, and rely on clever wordplay they can instantly repeat on the playground. These 15 school-safe, family-friendly dad jokes are tested and approved for morning announcements, lunchbox notes, and bedtime storytelling.",
"topic_link": "/topic/dad-jokes-for-kids/",
"topic_name": "Dad Jokes for Kids library",
"jokes": [
{"setup": "Why did the kid swallow coins?", "punch": "The teacher said he needed more sense."},
{"setup": "Why was the math book sad?", "punch": "It had too many problems."},
{"setup": "Why can't a leopard hide?", "punch": "Because he's always spotted."},
{"setup": "What do you call a dinosaur that sleeps all day?", "punch": "A dino-snore."},
{"setup": "What did the left eye say to the right eye?", "punch": "Between you and me, something smells."},
{"setup": "Why did the music teacher go to jail?", "punch": "Because she got caught with a sharp note."},
{"setup": "What did one plate say to another plate?", "punch": "Tonight, dinner's on me."},
{"setup": "Why did the picture go to jail?", "punch": "Because it was framed."},
{"setup": "What has hands but cannot clap?", "punch": "A clock."},
{"setup": "Why did the banana go to the doctor?", "punch": "Because it wasn't peeling well."},
{"setup": "What do you call a sleeping bull?", "punch": "A bulldozer."},
{"setup": "Why are fish so smart?", "punch": "Because they live in schools."},
{"setup": "What do you call an alligator in a vest?", "punch": "An investigator."},
{"setup": "Why did the bicycle fall over?", "punch": "It was two-tired."},
{"setup": "What do you call cheese that isn't yours?", "punch": "Nacho cheese."}
]
}
]
def page_blog_index():
cards = ''.join(f"""
{a['emoji']}
A dad joke is a short, clean, pun-based joke delivered with maximum confidence and zero shame. It's the kind of joke that makes your kids groan, your wife roll her eyes, and your dog leave the room. Science has yet to explain why hearing one makes you feel briefly smarter and visibly worse at the same time.
This site is a growing collection of the best dad jokes on the internet: one-liners, knock-knock jokes, and puns about animals, food, work, school, sports, tech, space and more. Every joke is family-friendly โ the only thing at risk of injury is everyone's patience. Start with the dad joke generator, browse the categories, or come back every day for a new dad joke of the day.
"""
title = 'Best Dad Jokes โ %d+ Funny, Clean Dad Jokes (One-Liners, Puns & Knock-Knocks)' % len(JOKES)
desc = ('%d clean, funny dad jokes: puns, one-liners, and knock-knocks by category. '
'Features a daily dad joke and free generator for maximum groans.'
% len(JOKES))
ld = {
"@context": "https://schema.org",
"@type": "WebSite",
"name": SITE_NAME,
"url": SITE_URL + '/',
"description": TAGLINE,
"potentialAction": {
"@type": "SearchAction",
"target": SITE_URL + "/search/?q={search_term_string}",
"query-input": "required name=search_term_string"
}
}
return layout(title, desc, body, '/', json_ld_script(ld))
def page_category(slug):
c = CAT_BY_SLUG[slug]
js = [j for j in JOKES if j['cat'] == slug]
cards = ''.join(joke_card(j) for j in js)
others = [o for o in CATS if o['slug'] != slug][:6]
others_html = ''.join('%s %s' % (o['slug'], o['emoji'], esc(o['name'])) for o in others)
# Internal link loop: related topic clusters that overlap with this category
cat_topics = [
t for t in TOPICS
if len(topic_jokes(t)) >= MIN_TOPIC_JOKES and
any(j['cat'] == slug for j in topic_jokes(t))
][:6]
topics_html = ''.join('%s %s' % (t['slug'], t['emoji'], esc(t['name'])) for t in cat_topics)
topic_section = f'
Explore Related Joke Topics
{topics_html}
' if topics_html else ''
body = f"""
{c['emoji']} {esc(c['name'])}
{esc(c['blurb'])} That's {len(js)} jokes of pure dad energy.
"""
title = 'Dad Joke Generator โ Random Dad Jokes, One Click'
desc = 'Press one button and get a random dad joke instantly. Hundreds of clean, funny dad jokes ready to embarrass your kids.'
return layout(title, desc, body, '/dad-joke-generator/')
def page_joke(j):
cat = CAT_BY_SLUG[j['cat']]
# Determine matching topic clusters for internal linking:
matching_topics = [t for t in TOPICS if len(topic_jokes(t)) >= MIN_TOPIC_JOKES and re.search(t['keywords'], (j['setup'] + ' ' + j['punch']).lower())][:3]
topic_chips = ''.join('%s %s' % (t['slug'], t['emoji'], esc(t['name'])) for t in matching_topics)
topic_section = f'
Related Topics:
{topic_chips}
' if topic_chips else ''
# Internal joke-reading loop: next/prev links and related same-category jokes:
prev_id = (j['id'] - 1) % len(JOKES)
next_id = (j['id'] + 1) % len(JOKES)
same_cat = [other for other in JOKES if other['cat'] == j['cat'] and other['id'] != j['id']]
rel1 = same_cat[j['id'] % len(same_cat)] if same_cat else None
rel2 = same_cat[(j['id'] + 7) % len(same_cat)] if len(same_cat) > 1 else None
related = [r for r in [rel1, rel2] if r]
related_cards = ''.join(joke_card(r) for r in related)
body = f"""
"""
title = 'Dad Joke of the Day โ A New Funny Dad Joke Daily'
desc = "Today's dad joke of the day, plus the full archive. One clean, funny dad joke for every day of the year."
ld = {
"@context": "https://schema.org",
"@type": "ItemPage",
"name": "Dad Joke of the Day",
"url": SITE_URL + '/joke-of-the-day/',
"mainEntity": {
"@type": "CreativeWork",
"name": j['setup'],
"text": j['punch']
}
}
return layout(title, desc, body, '/joke-of-the-day/',
'' % SITE_URL +
json_ld_script(ld))
def page_search():
body = """
๐ Search Dad Jokes
Looking for a dad joke about coffee, cats, or cardio? Type it in. We probably have a pun for that.
No jokes matched. Which, honestly, is a great setup for a new dad joke โ send it to us via the contact page.
"""
title = 'Search Dad Jokes โ Find a Dad Joke About Anything'
desc = 'Search hundreds of clean dad jokes by keyword. Find puns and one-liners about any topic instantly.'
return layout(title, desc, body, '/search/')
def page_about():
body = """
๐ About Best Dad Jokes
Welcome to BestDadJokes.lol โ a growing collection of the internet's best dad jokes: short, clean, pun-heavy, and delivered with the quiet confidence only a dad can muster.
The mission is simple: build the most useful dad joke resource on the internet. That means:
Curated, not scraped. Every joke is hand-picked for maximum groan. If it doesn't make someone audibly sigh, it doesn't make the cut.
Family-friendly, always. Clean humor that's safe to tell at the dinner table, the office, or the school pickup line.
Fast and simple. No pop-ups, no logins, no nonsense. Just jokes.
Why dad jokes?
Because a dad joke is never just a joke. It's a love language. It's saying "I would rather embarrass myself than miss a chance to make you laugh." Also, they're free, and this is a budget operation.
Get in touch
Got a joke that deserves to be here? Found a bug? Want to license 300 dad jokes for your family group chat? Head to the contact page.
"""
title = 'About โ Best Dad Jokes .lol'
desc = 'BestDadJokes.lol is a curated collection of clean, funny dad jokes. Hand-picked jokes, family-friendly humor, zero nonsense.'
return layout(title, desc, body, '/about/')
def page_contact():
body = """
๐ฎ Contact
Want to send us the greatest dad joke of all time? Report a joke that's more "dad" than "joke"? Tell us the site made you laugh so hard you spilled your coffee? We read everything.
Include the setup and the punchline in your email. If we use it, you get full bragging rights and absolutely no money, which is exactly how dad economics works.
"""
title = 'Contact โ Best Dad Jokes .lol'
desc = 'Get in touch with BestDadJokes.lol โ submit a dad joke, say hi, or report a bug.'
return layout(title, desc, body, '/contact/')
def page_privacy():
body = """
Privacy Policy
Last updated: %s
BestDadJokes.lol respects your privacy, which is ironic because dads famously respect nothing more than a good interruption. Here's the deal in plain English:
What we collect
We keep standard web server logs (IP address, browser type, pages visited) for security and aggregate traffic statistics. We do not ask for your name, email, or your kids' report cards. There are no accounts on this site.
Cookies and advertising
We may display advertising on this site to keep it free. Advertising partners, which may include Google, use cookies and similar technologies to serve ads based on your prior visits to this and other websites.
Google's use of advertising cookies enables it and its partners to serve ads based on your visits to this site and/or other sites on the Internet. You may opt out of personalized advertising by visiting Google Ads Settings, or opt out of third-party vendor cookies at aboutads.info.
If we run a consent banner for visitors from the EEA/UK, your choices will be honored and stored locally.
Analytics
We use aggregate, privacy-respecting analytics to count page views and understand which categories people enjoy. This data cannot reasonably be used to identify you.
Data sharing
We do not sell personal data. We have no personal data to sell. We barely have data.
Children
Content on this site is family-friendly by design. The site is not directed at children under 13, and we do not knowingly collect personal information from children.
""" % datetime.date.today().strftime('%B %d, %Y')
title = 'Privacy Policy โ Best Dad Jokes .lol'
desc = 'Privacy policy for BestDadJokes.lol โ what we collect (very little), cookies, advertising, and your choices.'
return layout(title, desc, body, '/privacy-policy/')
def page_terms():
body = """
Terms of Use
Last updated: %s
By using BestDadJokes.lol you agree to the following terms. Reading them aloud in a dad voice is optional but encouraged.
Use of content
The jokes on this site are provided for personal, non-commercial enjoyment. Share them freely at dinner tables, offices, and group chats. If you want to republish jokes in bulk or use this site commercially, contact us first โ we're reasonable people.
No warranties
This site is provided "as is." We make no guarantees that jokes will be funny, that groans will be produced, or that your teenagers will acknowledge your existence. All comedic risk is yours.
Limitation of liability
To the fullest extent permitted by law, BestDadJokes.lol is not liable for any damages arising from use of the site, including but not limited to eye-rolling, sighing, involuntary chuckling, and children hiding your phone.
External links
We are not responsible for the content of external websites, including their jokes, which are almost certainly worse than ours.
Changes
We may update these terms occasionally. Continued use of the site means you accept the updated terms, and possibly a fresh dad joke.
""" % datetime.date.today().strftime('%B %d, %Y')
title = 'Terms of Use โ Best Dad Jokes .lol'
desc = 'Terms of use for BestDadJokes.lol.'
return layout(title, desc, body, '/terms/')
def page_gifts():
body = """
๐ Gift Guide & Merch
The Best Gifts for Dads Who Love Dad Jokes
Hand-picked gear, books, and novelty gifts for dads who never miss an opportunity to deliver a punchline.
๐
Exceptionally Bad Dad Jokes
Spiffing illustrated book of painfully terrible dad jokes, puns, and one-liners.
Disclosure: When you purchase through links on our site, we may earn an affiliate commission at no extra cost to you.
"""
return layout('Best Gifts for Dads Who Love Dad Jokes ยท Best Dad Jokes',
'Hand-picked gear, books, and novelty gifts for dads who love groan-worthy humor.',
body, '/best-dad-gifts/')
def page_404():
body = """
404
This page is like a dad joke that got cut from the site โ it just didn't land.
"""
return layout('404 โ Page Not Found', 'Page not found. The joke is on us.', body, '/404.html')
def write(path, content):
full = os.path.join(SITE_DIR, path)
os.makedirs(os.path.dirname(full), exist_ok=True)
with open(full, 'w') as f:
f.write(content)
def build():
if os.path.exists(SITE_DIR):
shutil.rmtree(SITE_DIR)
os.makedirs(SITE_DIR)
# static assets
st = os.path.join(SITE_DIR, 'static')
os.makedirs(st, exist_ok=True)
for fn in os.listdir(STATIC):
shutil.copy(os.path.join(STATIC, fn), st)
# jokes data for client-side JS
payload = {
'categories': [{'slug': c['slug'], 'name': c['name'], 'emoji': c['emoji']} for c in CATS],
'jokes': [{'id': j['id'], 'cat': j['cat'], 'type': j.get('type', 'qa'),
's': j['setup'], 'p': j['punch']} for j in JOKES]}
write('static/jokes-data.js',
'window.BDJ=%s;' % json.dumps(payload, ensure_ascii=False, separators=(',', ':')))
write('index.html', page_index())
for c in CATS:
write('category/%s/index.html' % c['slug'], page_category(c['slug']))
for t in TOPICS:
page = page_topic(t['slug'])
if page:
write('topic/%s/index.html' % t['slug'], page)
write('dad-joke-generator/index.html', page_generator())
write('joke-of-the-day/index.html', page_jotd())
write('blog/index.html', page_blog_index())
for a in BLOG_ARTICLES:
write('blog/%s/index.html' % a['slug'], page_blog_article(a))
for j in JOKES:
write('joke/%s/index.html' % j['id'], page_joke(j))
write('search/index.html', page_search())
write('about/index.html', page_about())
write('contact/index.html', page_contact())
write('privacy-policy/index.html', page_privacy())
write('terms/index.html', page_terms())
write('best-dad-gifts/index.html', page_gifts())
write('404.html', page_404())
# robots + sitemap
pages = ['/', '/blog/', '/dad-joke-generator/', '/joke-of-the-day/', '/search/', '/about/', '/contact/',
'/privacy-policy/', '/terms/', '/best-dad-gifts/'] + ['/blog/%s/' % a['slug'] for a in BLOG_ARTICLES] \
+ ['/category/%s/' % c['slug'] for c in CATS] \
+ ['/topic/%s/' % t['slug'] for t in TOPICS if len(topic_jokes(t)) >= MIN_TOPIC_JOKES] + ['/joke/%s/' % j['id'] for j in JOKES]
robots_content = """# robots.txt for bestdadjokes.lol
User-agent: *
Allow: /
# Explicit AI Search & Discovery Crawlers
User-agent: GPTBot
Allow: /
User-agent: OAI-SearchBot
Allow: /
User-agent: PerplexityBot
Allow: /
User-agent: ClaudeBot
Allow: /
User-agent: Google-Extended
Allow: /
User-agent: Applebot-Extended
Allow: /
Sitemap: %s/sitemap.xml
""" % SITE_URL
write('robots.txt', robots_content)
llms_content = f"""# Best Dad Jokes (bestdadjokes.lol)
> The best dad jokes on the internet โ short, clean, groan-worthy, and 100% family-friendly.
Best Dad Jokes provides over {len(JOKES)} hand-curated, school-safe dad jokes, puns, and holiday one-liners organized across {len(CATS)} categories and {len([t for t in TOPICS if len(topic_jokes(t)) >= MIN_TOPIC_JOKES])} targeted topic clusters. All jokes are formatted for high clarity, instant reading, and family entertainment.
## Core Hubs & Curated Lists
- [Home](https://bestdadjokes.lol/): Daily featured jokes, random joke generator, and popular categories.
- [Blog & Curated Lists](https://bestdadjokes.lol/blog/): High-intent curated lists with quick-copy formatting.
- [12 Thanksgiving Dad Jokes That Will Make the Whole Table Groan](https://bestdadjokes.lol/blog/thanksgiving-dad-jokes-that-will-make-the-table-groan/)
- [15 Clean Halloween Dad Jokes for Kids & Trick-or-Treaters](https://bestdadjokes.lol/blog/clean-halloween-dad-jokes-for-kids-and-trick-or-treaters/)
- [15 Best Dad Jokes for Kids (School-Safe Puns & Groaners)](https://bestdadjokes.lol/blog/best-dad-jokes-for-kids-school-safe-puns/)
- [Joke of the Day](https://bestdadjokes.lol/joke-of-the-day/): Daily refreshed family joke.
- [Dad Joke Generator](https://bestdadjokes.lol/dad-joke-generator/): Instant randomized joke player.
- [Search Dad Jokes](https://bestdadjokes.lol/search/): Instant search across all 430+ jokes.
- [Dad Gifts & Merch](https://bestdadjokes.lol/best-dad-gifts/): Curated gift guide and funny gear for dads who love dad jokes.
## Seasonal & Holiday Clusters
- [Thanksgiving Dad Jokes](https://bestdadjokes.lol/topic/thanksgiving-dad-jokes/): Clean turkey puns, feast humor, and pilgrim jokes.
- [Halloween Dad Jokes](https://bestdadjokes.lol/topic/halloween-dad-jokes/): Ghost, skeleton, and spooky family-safe puns.
- [Christmas Dad Jokes](https://bestdadjokes.lol/topic/christmas-dad-jokes/): Santa, elf, and winter holiday humor.
- [Dad Jokes for Kids](https://bestdadjokes.lol/topic/dad-jokes-for-kids/): Elementary-safe puns and animal humor.
- [Work Dad Jokes](https://bestdadjokes.lol/topic/work-dad-jokes/): Clean office jokes and water-cooler puns.
## Open APIs for AI & Bots
- [Random Dad Joke API (JSON)](https://bestdadjokes.lol/api/v1/random.json): Returns a single clean dad joke in JSON format (`{{id, setup, punchline, category}}`).
- [Today's Joke of the Day API (JSON)](https://bestdadjokes.lol/api/v1/today.json): Returns the canonical joke of the day.
"""
write('llms.txt', llms_content)
today = datetime.date.today().isoformat()
sm = ['',
'']
for p in pages:
# Hierarchical SEO crawl prioritization:
if p == '/':
freq, pri = 'daily', '1.0'
elif p in ('/dad-joke-generator/', '/joke-of-the-day/'):
freq, pri = 'daily', '0.9'
elif '/topic/' in p or p == '/blog/':
freq, pri = 'daily', '0.8'
elif '/category/' in p or '/blog/' in p:
freq, pri = 'weekly', '0.7'
elif '/joke/' in p:
freq, pri = 'weekly', '0.6'
else:
freq, pri = 'monthly', '0.5'
sm.append('%s%s%s%s%s'
% (SITE_URL, p, today, freq, pri))
sm.append('')
write('sitemap.xml', '\n'.join(sm) + '\n')
# RSS: dad joke of the day feed, last 21 days
from email.utils import formatdate
now_ts = datetime.datetime.utcnow().timestamp()
items = []
for back in range(21):
d = datetime.date.today() - datetime.timedelta(days=back)
j = JOKES[d.toordinal() % len(JOKES)]
ts = now_ts - back * 86400
items.append(
'%s%s/joke-of-the-day/?d=%s'
'bjd-daily-%s'
'%s%s โ %s'
% (esc('Dad Joke of the Day โ %s' % d.strftime('%b %d')), SITE_URL, d.isoformat(),
d.isoformat(), formatdate(ts), esc(j['setup']), esc(j['punch'])))
rss = (''
'%s โ Dad Joke of the Day'
'%s/joke-of-the-day/%s'
'en-us%s'
% (esc(SITE_NAME), SITE_URL, esc(TAGLINE), ''.join(items)))
write('rss.xml', rss)
# free JSON API
rnd = JOKES[(datetime.datetime.utcnow().microsecond // 1000) * len(JOKES) // 1000]
tod = JOKES[datetime.date.today().toordinal() % len(JOKES)]
def api_j(j):
return json.dumps({'setup': j['setup'], 'punchline': j['punch'], 'type': j.get('type', 'qa'),
'category': j['cat'],
'source': SITE_URL + '/category/%s/#joke-%d' % (j['cat'], j['id'])},
ensure_ascii=False)
write('api/v1/random.json', api_j(rnd))
write('api/v1/today.json', api_j(tod))
total = sum(os.path.getsize(os.path.join(dp, f)) for dp, dn, fn in os.walk(SITE_DIR) for f in fn)
nfiles = sum(len(fn) for dp, dn, fn in os.walk(SITE_DIR))
print('Built %d files into %s (%d bytes)' % (nfiles, SITE_DIR, total))
if __name__ == '__main__':
build()