robots.txt for a calculator site: what I let search engines crawl
When I built my pay calculator site, robots.txt was one of those files I nearly skipped. It is a plain text file, it does no maths, and nobody ever sees it. Then I realised it is the first thing a search crawler reads, a
When I built my pay calculator site, robots.txt was one of those files I nearly skipped. It is a plain text file, it does no maths, and nobody ever sees it. Then I realised it is the first thing a search crawler reads, and getting it wrong means pages I spent hours on never get found at all.
What robots.txt actually does
A crawler asks for /robots.txt before it touches anything else. The file tells it which paths it may crawl and which it should leave alone. It is a request, not a lock — well-behaved crawlers obey it, and bad bots ignore it entirely. So it is a signpost for Google and Bing, not a security fence. Nothing in it keeps a page private.
That distinction shaped every line I wrote. If a page should not be seen by anyone, it does not belong on a public site at all. robots.txt is only about crawl budget: which of the public pages are worth a crawler's time.
The file I ended up with
Mine is short, and that is the point:
User-agent: *
Allow: /
Sitemap: https://mytimecardcal.com/sitemap.xml
Three ideas in five lines. Every crawler is welcome, every public path is open, and here is the sitemap if you want the full list instead of discovering pages one link at a time.
Why I allow everything
A calculator site has no admin area, no login pages, no search results worth hiding, and no private files. Every page is a tool or a guide that exists to be found. Blocking any of them would only hurt.
The temptation is to add Disallow lines for things that look messy. I checked each one before deciding:
-
Query strings. The calculators do not use query strings for content. Shared results travel in the URL hash, like
#mon=9-17, and crawlers never send the hash to the server, so there is nothing to block. - Duplicate pages. The 51 state overtime pages look alike to a human skimming them, but each one carries its own state's rules, wage and worked example. They are different pages with different answers, so all of them stay crawlable.
- The sitemap itself. Some people block it by accident with a careless wildcard. Mine is named in the file, and the sitemap lists every calculator, guide and state page.
What I deliberately left out
I did not add a Crawl-delay line. Google ignores it, and the crawlers that honour it are not the ones eating my bandwidth. I did not list every crawler by name either. One User-agent: * rule covers the lot, and a long file full of named bots is just more lines to get wrong.
I also did not use robots.txt to hide pages from search results. That is a common misunderstanding. Blocking a page in robots.txt stops the crawler reading it, but Google can still list the URL if other sites link to it. If I ever need a page out of the index, the right tool is a noindex meta tag, not a robots.txt line.
How I checked it worked
After uploading, I fetched the file in a browser and with curl to make sure it returned a 200 status and the exact text I wrote, not a hosting error page. Then I checked that the sitemap URL inside it also loaded, because a robots.txt pointing at a dead sitemap is worse than no pointer at all. Both files sit at the root, next to the homepage, where crawlers expect them.
The lesson is a boring one, and I mean that as praise: a five-line file, written once, checked twice, and then left alone. Most of the site's real work is in the calculators. robots.txt just makes sure the crawlers can find them. You can see the result in action on mytimecardcal.com, where every calculator and state page is one click from the homepage.
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.