DEV Community

Why AI Crawlers Need Server-Rendered HTML on Directory Pages

If you build local directory sites, you have probably reached for a JavaScript framework at some point. Load the listings from a JSON file, render the cards in the browser, add filters on the client side. It feels tidy, and to a person with a modern browser the result looks identical to a page of plain HTML.

To many AI crawlers, it does not. A page whose listings only exist after JavaScript runs can look nearly empty to a bot that reads the raw response. For a directory, where the listings are the whole point, that is a real loss. This post looks at how crawlers read pages, how to check what yours actually serve and how to structure a static directory so the content is in the HTML from the start.

How crawlers read a page

Googlebot fetches a page, then queues it for rendering in a headless Chrome so it can see content added by JavaScript. That rendering step costs Google time and resources, and it can lag behind the first crawl, but it does happen.

Many AI crawlers behave differently. Vercel published an analysis in late 2024 of crawler traffic across its network and reported that the crawlers from OpenAI and Anthropic fetched JavaScript files but did not execute them. Gemini, by contrast, relies on Google's crawling infrastructure. Crawler behavior can change at any time, but the safe assumption today is that an AI crawler sees your HTML response and little else.

For a directory, that means a city page rendered on the client may arrive as a header, a footer and an empty div where the listings should be.

Check what your pages actually serve

The quickest test is to fetch a page without a browser and look for the content you care about. Pick a city page and count the listing cards in the raw HTML:

curl -s https://example-directory.com/tacoma/ | grep -c 'class="listing-card"'
Enter fullscreen mode Exit fullscreen mode

If the count matches the number of listings you see in the browser, the content is in the HTML. If it prints zero, your listings depend on JavaScript. Run the same check on a category page, a listing page and the homepage, since frameworks sometimes pre-render some routes and not others.

It is also worth viewing the source of a page, rather than inspecting the live DOM in dev tools. The source shows the response a crawler gets. The inspector shows the page after scripts have run.

Build the HTML at build time

The cleanest fix is to generate every page as finished HTML during the build. A static site generator reads your cleaned listing data, loops over counties, cities and categories, and writes one HTML file per page with every listing already in the markup.

JavaScript can still add value on top. Client-side filtering, a map and a search box all work well as layers on top of a page that already makes sense without them. The rule is simple: the listings, headings, addresses and phone numbers should be in the HTML, and JavaScript should only change how they are shown.

If you use a framework like Next.js, Astro or Eleventy, use its static generation or server rendering options rather than pure client rendering for directory pages. Each has a documented way to produce full HTML for every route at build time.

Make the HTML easy to read

Once the content is in the response, make it easy to parse. Use real headings for the page title and sections. Put each listing in a consistent wrapper with the business name in a heading or a link, followed by the address, phone and hours as plain text. Avoid hiding details behind tabs or accordions that only fill in when clicked.

Internal links matter too. Crawlers move through a site by following links, so county pages should link to their cities, cities to their categories and listings back to the city. A sitemap helps, but it does not replace a clear link structure.

Our Hugging Face notes on how AI assistants read local directory pages look at the same question from the search side, including how assistants pick sources to cite.

Do not forget robots.txt

Server-rendered HTML only helps if the crawler is allowed in. Check that your robots.txt does not block the AI crawlers you want to reach your pages. Several of these companies run separate bots for training and for live search, and they can be allowed or blocked independently by user agent. Read each company's crawler documentation before you write rules, since the names and purposes change.

For broader coverage of AI search and directory tech, see our notes on AI search and tech niches for directory sites.

Questions about AI crawlers and directory HTML

Does this mean I should avoid JavaScript entirely?

No. Use it for filtering, maps and small interactions. Just make sure the core content of every page is already in the HTML before any script runs.

Will server-rendered HTML make AI assistants cite my directory?

It removes one barrier, but it guarantees nothing. Assistants choose sources in ways that are not public. Clean HTML means that when a crawler does visit, it can read what is there.

What about pages behind a search form?

Crawlers do not fill in forms, so results that only appear after a search are invisible to them. Make sure every listing is reachable from a normal link on a static page. 1 Click Directory Builder outputs a complete static site from a Google Maps export, with its county and city pages generated as plain HTML files.

Top comments (0)