SEO for Static Websites: What You Get Free and What You Must Build
SEO for static websites starts with an advantage: every page is complete HTML that Google and AI crawlers read on the first request, with no database behind it and no script to run. What you lose is the CMS and its plugins, which wrote titles, sitemaps, canonicals, 404 pages and redirects. Your templates, build and host now do that work.
By Raúl Díaz, founder of Slibur
14 min read

In this article
"Static" here means HTML files written by hand or a site built by a generator such as Hugo, Jekyll, Eleventy or Astro, served from Cloudflare Pages, Netlify, GitHub Pages or a plain web server. Being static isn't a ranking factor in itself. Most failures come from defaults nobody changed.
What a static site gives you, and what it takes away
Three things work in your favor before you touch a setting:
- The content is in the first response. Google's JavaScript guide says Googlebot puts pages in a render queue, for a few seconds or longer, before it sees what scripts add, and it still recommends pre-rendering because not all bots can run JavaScript. On a static page the text is there before that step.
- Files come from a cache. Nothing queries a database on each visit. Cloudflare Pages, for one, keeps deployed assets cached on its CDN until the next deployment and serves Gzip and Brotli responses whenever possible.
- The markup stays put. No plugin update rewrites your head tags overnight. The HTML you deploy is the HTML crawlers get.
What you give up is the plugin layer that did SEO chores without being asked. Each chore now needs a home of its own:
| A CMS did this | On a static site it lives in | If nobody sets it up |
|---|---|---|
| Title and meta description per page | The page head, or front matter read by the base template | Every page ships the template's title |
| Canonical URL | The template, from one site URL setting | /about, /about/ and /about.html compete |
| XML sitemap | A generator plugin or a build script | The list goes stale after the next deploy |
| robots.txt | A file in the folder copied as is to the output | Missing, or a staging Disallow: / goes live |
| 404 page | A 404.html file and the host's defaults | Unknown URLs answer with the home page |
| Redirects | The host's redirect file or the server config | Old links and backlinks end on errors |
| Structured data | JSON-LD printed by the templates | None at all |
| Contact form | A host feature, a form service or a function | No server to receive the message |
The sections below take those rows one at a time, with the host defaults that decide each one.
Titles, descriptions and canonicals come from the template
Google wants a title element on every page with distinct text that describes it, and its title link guide warns against repeated or boilerplate titles. Its meta description guide asks for a unique description per page as well, even though Google builds most snippets from the page content and only sometimes uses the description. A CMS plugin fills these in. On a static site, they're only as good as your template.
Hand-coded HTML. Each file carries its own head, so the classic failure is copying about.html to start services.html and never touching the head. This one-liner over the output folder prints any title used more than once:
grep -rhoE '<title[^>]*>[^<]+' public/ | sort | uniq -d
A generator. Put title and description in each page's front matter and let the base layout print them. Better, make the build stop when a page has no description, so a missing tag fails on your laptop and not months later in Search Console. Which head tags Google actually reads is covered in meta tags for SEO.
Pick one URL format before you write a canonical
Every indexable page should carry a self-referencing canonical, absolute and built from one site URL setting so it never points at a staging host. Google's guide to consolidating duplicate URLs (opens in a new tab) treats rel="canonical" in the head as one of its signals and offers a rel="canonical" HTTP header for files such as PDFs.
On static sites the trap is the URL format itself. Hosts rewrite file paths, and the setting in your generator may not be what ships:
- Cloudflare Pages redirects
/contact.htmlto/contactand/about/index.htmlto/about/. A canonical, menu link or sitemap entry with.htmlin it points at a redirect. - Astro has a
trailingSlashoption, but its configuration reference says trailing slashes on prerendered pages are handled by the hosting platform and may not respect your choice. - Hand-coded sites often answer both
/about.htmland/about/when both files exist.
Test before you template. Request each variant with curl -I, pick the one that returns 200 without a redirect, and use it in canonicals, internal links and the sitemap. Settle the protocol and host the same way: Google prefers HTTPS pages as canonical and suggests redirecting HTTP to HTTPS, so http:// and whichever of www or the bare domain you don't use should reach the chosen address in a single 301.
Sitemap and robots.txt, rebuilt on every deploy
A sitemap written once by hand goes stale the day you add a page. Generate it at build time from the same list of pages the generator renders. Jekyll's jekyll-sitemap plugin is on GitHub Pages' list of supported plugins, and most generators have a plugin or integration that does the same. For a hand-coded site, a short script that walks the output folder is enough.
The trap specific to static builds is the date. Google's guide to building a sitemap (opens in a new tab) says it uses lastmod only if it's consistently and verifiably accurate, and a script that stamps every URL with the build time claims that every page changed on every deploy. Take the date from the content file's last real edit, or leave lastmod out.
Keep noindex pages, redirected URLs, the 404 page and thank-you pages out of the file, and write each URL in the same format as its canonical. Size limits, index files and submission are covered in sitemaps for SEO.
robots.txt is a plain text file. Put it in the folder your generator copies untouched to the output, usually public/ or static/, which Cloudflare's documentation names as the home of favicons, robots.txt and other deploy-ready files. Keep it short: allow crawling and point to the sitemap.
Two mistakes repeat. A Disallow: / left from a staging build blocks everything. And robots.txt doesn't hide pages: Google's introduction says it isn't a mechanism for keeping a page out of Google, and its noindex page adds that a page blocked by robots.txt never shows the crawler its noindex rule.
That same file decides which AI crawlers get in, and OpenAI lets you allow its search crawler while blocking the one that gathers training data. After a deploy, the free AI crawler checker shows which AI bots the live robots.txt lets in and which line blocks each one.
Keep the Search Console file in the build
If you verified Search Console by HTML file upload, that file has to survive every build. Search Console checks from time to time that the token is still there, warns you when it can't confirm it, and removes permissions after a grace period. A clean build deletes the file unless it sits in the same copy-as-is folder as robots.txt. A Domain property verified with a DNS record avoids the issue.
404 pages: your host sets the status code
A missing page should answer with a 404 status. Google's documentation on HTTP status codes says that when a 200 response carries an error message or an empty page, Search Console reports a soft 404. On a static site, whether a missing URL returns 404 depends on one file and the host's defaults:
- Cloudflare Pages. With no top-level
404.html, Pages assumes the project is a single-page application and serves the root for any path that doesn't match a file. Every mistyped link, old URL and deleted page then shows your home page. Cloudflare's Serving Pages (opens in a new tab) reference explains both behaviors: add a404.htmlat the root, and optionally more in folders such as/blog/404.html, and Pages picks the closest one up the tree. - Netlify. A
404.htmlis picked up and shown automatically for any failed path. A rule such as/en/* /en/404.html 404in the redirects file gives a folder its own page. - GitHub Pages. Add a
404.html, or a404.mdwithpermalink: /404.htmlin its front matter. - Your own server. Point the server's error page setting at the file and confirm the status line still says 404, not 200.
Then test it the way a crawler would, after every change of host or generator:
curl -sI https://example.com/no-such-page | head -1
The first line should show a 404. Make the page useful while you're at it: a one-line message, the main navigation and links to the sections people look for most.
Redirects belong to the host, not the HTML
When a URL changes, the old address needs a permanent redirect. Google's redirects guide (opens in a new tab) counts server-side 301 and 308 responses as permanent, and a meta refresh too when its delay is 0 seconds, which matters on hosts that can only serve HTML files. Each static host gets there differently:
| Host | Where redirects go | What to watch |
|---|---|---|
| Cloudflare Pages | A _redirects file in the build output | The default status is 302, so write 301 on every line; 2,000 static and 100 dynamic rules per file |
| Netlify | _redirects or netlify.toml | Default 301, but a rule doesn't fire while a file still exists at the old path, unless the rule is forced |
| GitHub Pages | No server configuration such as .htaccess | jekyll-redirect-from writes HTML pages with a meta refresh |
| Apache or Nginx | .htaccess or the server block | Google's guide shows both syntaxes |
The Cloudflare default is the one that bites: a line like /old-page /new-page with no code sends a temporary 302, so Google keeps showing the old URL.
The copy on pages.dev
Cloudflare Pages creates a your-project.pages.dev address on your first deployment, and it keeps serving the site after you add a custom domain. Preview deployments get an X-Robots-Tag: noindex header by default; the production pages.dev address doesn't, so it's a full copy of your site.
Cloudflare's own fix is a Bulk Redirect from that address to your domain with a 301. Its _headers documentation also shows a rule that adds X-Robots-Tag: noindex to every pages.dev URL. The redirect is the stronger option, since a permanent redirect also tells Google which URL is canonical.
Rules that outgrow these files, such as headers per path or logic by country, move to the CDN; edge SEO covers that layer and how to test it. Moving a CMS site to static means mapping every old URL before launch, and the site migration checklist walks through it.
Structured data goes in the templates
On a static site, structured data is a JSON-LD script block that the layout prints from front matter. A typical set looks like this:
- Organization and WebSite on the home page.
- Article or BlogPosting, with dates and author, on each post.
- BreadcrumbList wherever the page shows breadcrumbs.
- LocalBusiness for a business with an address and opening hours.
Google's introduction to structured data says most Search features use the schema.org vocabulary, that required properties are needed for a page to be eligible, and that fewer but complete and accurate recommended properties beat many badly formed ones. A template error repeats on every page that uses the template, so test one page of each type with Google's Rich Results Test after any layout change.
Leave out markup for features you won't get. Google stopped showing FAQ rich results in Search from May 7, 2026, and has since removed their documentation. Types and full examples are in schema markup for SEO.
Forms without a server
A static host serves files and has nowhere to send a contact form. You need a form feature from the host, a third-party form service or a small serverless function, and each comes with an SEO detail:
- Netlify Forms. Turn on form detection in the Netlify UI, then add
data-netlify="true"to the form tag. Netlify finds forms by parsing your HTML when the build completes, so a form rendered only by JavaScript is invisible to it. The workaround is a hidden HTML copy of the form with the same field names. - The thank-you page. Netlify sends visitors to a generic success page unless the form's
actionpoints to your own, such as/pages/success. Give that page a noindex tag and keep it out of the sitemap, or it can turn up in search. - Functions. On Cloudflare Pages, rules in
_redirectsand_headersdon't apply to responses generated by Pages Functions. If a function handles the form, set its redirects and headers in code. - Spam. Cloudflare Turnstile can be added to any site without routing traffic through Cloudflare, and it works without showing visitors a CAPTCHA.
Crawlers don't fill in forms, so put the phone number, email and street address in the page text next to the form, where Google and AI assistants can read them.
Keep the speed advantage
A static page starts fast. What usually slows it down is what gets added later: full-size images, web fonts and third-party scripts. Google's Core Web Vitals guide sets the targets for a good experience: Largest Contentful Paint within 2.5 seconds, Interaction to Next Paint under 200 milliseconds and Cumulative Layout Shift under 0.1.
- Images in the copy-as-is folder skip the optimizer. Astro's image guide says files in
public/are served or copied as is, with no processing, and recommends keeping local images insrc/so Astro can optimize them. The same folder that keeps robots.txt intact ships a full-size photo just as untouched, so resize images before they go there or keep them where the generator processes them. - Scripts added later. Chat widgets, tag managers and embeds bring back the JavaScript the static build left out. Load them only on the pages that use them.
After launch and after each redesign, Search Console's Core Web Vitals report shows how your pages perform.
What AI crawlers read on a static site
Static HTML is what AI crawlers read best, because most of them don't run JavaScript: Vercel and MERJ's analysis of crawler traffic, published December 17, 2024, found that none of the major AI crawlers rendered it. Which crawlers were measured, the two exceptions and the request figures are in the JavaScript SEO guide.
A static site passes that test by default, with one exception: React or Vue setups that ship a near-empty shell and build the page in the browser, even when the host calls them static. Open View Source on a deep page. If the main text isn't there, AI crawlers don't get it either, and the same guide explains how server rendering or prerendering puts it back.
Besides robots.txt, bot protection at a CDN can turn crawlers away before they reach a file, which the edge SEO guide above also covers.
An llms.txt file is optional. On a static site it's one more Markdown file in the copy-as-is folder, and the llms.txt generator builds a draft from a domain's sitemap and pages, ready to edit. Google's guide to generative AI search (opens in a new tab) says Google Search doesn't use these files, so any gain comes from other services that read them.
Slibur dataChatGPT, United States, 4 answers, November 21, 2026
What ChatGPT said about static website SEO
We asked ChatGPT four questions on November 21, 2026, from the United States: which static site generator is best for SEO, how to do SEO on a static HTML site without a CMS, which free host is best for a static site when SEO matters, and whether AI crawlers such as GPTBot and ClaudeBot read static HTML better than JavaScript sites.
It picked a winner whenever the question invited one: Astro as the "best overall" generator, Cloudflare Pages as the "best overall" free host. The answer that crowned Astro also said no generator automatically produces good SEO. Astro, Hugo, Eleventy, Next.js, GitHub Pages and Google Search Console each came up twice.
Its sources were official pages published by the companies themselves, led by Google's documentation, which appeared in three of the four answers. No SEO blog or agency made the list.
The no-CMS answer got the basics right: a unique title and description per page, a canonical tag, a sitemap, a robots.txt warning against hiding pages with it, JSON-LD and Search Console. But its samples used .html URLs in the canonical, the menu and the sitemap. On Cloudflare Pages, the host it picked one answer later, /residential-roofing.html would redirect to /residential-roofing, so the canonical would point at a redirect.
For hosting, it said to use a custom domain rather than pages.dev, but not that the pages.dev copy stays online, that _redirects defaults to 302 or what happens without a 404.html.
On AI crawlers it answered "Generally, yes", adding that they "can often read JavaScript-rendered sites", and for ClaudeBot it cited an Anthropic system card rather than a crawler study. Its rule of thumb holds up: a crawler should understand the page from View Source alone. None of the four answers mentioned llms.txt or contact forms.
A static SEO checklist for every deploy
- Every page has its own title and description, and the build fails without them.
- Canonicals, internal links and sitemap entries use the URL format the host serves with a 200.
- The sitemap is rebuilt on each deploy, lists only indexable pages and leaves
lastmodout unless it's real. - robots.txt reaches the output, has no staging
Disallow: /, names the sitemap and lets in the AI crawlers you want. - A request for a made-up URL returns a 404 with your own
404.html. - Every changed URL has a 301 in the host's redirect file, and no leftover file blocks the rule.
- The host's own subdomain, such as
pages.dev, redirects to your domain. - JSON-LD passes the Rich Results Test on one page of each template.
- Thank-you pages carry noindex, and the Search Console file survives a clean build.
- View Source on a deep page shows the main text.
What this checklist can't measure
Every item on that list can be checked from a terminal or a browser tab. Whether ChatGPT names your business when someone describes what you sell can't: it changes with the question and with the pages each answer draws on, which may not be yours.
Slibur shows that side one question at a time. During the free 7-day trial, with no credit card, you add up to 10 of the questions your customers ask, and on signup day it puts them to ChatGPT, Google AI Overviews, Claude, Perplexity and Grok. The dashboard starts with the questions where no AI names or cites you, then shows who appears in your place and which sources each answer uses. Try Slibur free for 7 days.
Frequently asked questions
Is a static website good for SEO?
Yes for crawling and speed. Every page arrives as complete HTML, so Google and AI crawlers read it without running scripts, and files are served from a cache instead of a database. Being static earns no ranking bonus, though. Titles, descriptions, canonicals, the sitemap, robots.txt, 404 responses and redirects still have to be set up in your templates, build and host, because no CMS plugin does it for you.
How do I redirect a page on a static website?
Use your host's redirect file, not the HTML. On Cloudflare Pages, add a line to _redirects and write 301 at the end, because the default is a temporary 302. On Netlify, _redirects defaults to 301, but the rule only fires once the old file is gone or the rule uses Netlify's force option. GitHub Pages has no server configuration, so jekyll-redirect-from writes pages with a meta refresh, which Google treats as permanent when the delay is 0 seconds.
Why does my static site show the home page for every missing URL?
On Cloudflare Pages, a project without a top-level 404.html is treated as a single-page application, and the root is served for any path that doesn't match a file. Add a 404.html at the root of the build output, deploy, and request a made-up URL with curl -sI to confirm the status line now says 404. Google reports error pages that answer 200 as soft 404s in Search Console.
Do I need a sitemap on a static website?
It's the simplest way to tell Google about every page when no CMS does it for you, so generate one on each build. List only indexable pages that return 200, use the same URL format as your canonicals, and stay under 50,000 URLs or 50MB per file. Leave out priority and changefreq, which Google ignores, and only include lastmod when it reflects a real content change rather than the build time.
Can ChatGPT read a static website?
If the text is in the HTML and robots.txt lets OpenAI's crawlers in, yes. OAI-SearchBot is the one that surfaces sites in ChatGPT search, GPTBot collects content that may be used for training, and OpenAI lets you allow or block each one separately. A static page has an edge here because, in Vercel and MERJ's 2024 analysis, none of the major AI crawlers executed JavaScript. Being readable doesn't mean ChatGPT will mention you, which depends on the pages its answers draw on.
Should a static site have an llms.txt file?
It's optional. The llms.txt proposal describes a Markdown file at the site root with a title, a summary and links to your key pages, meant for language models. On a static site it's one file in the folder copied to the output, so it costs little. Google says Google Search doesn't use llms.txt files, so one neither helps nor harms your Google rankings.
Which static site generator is best for SEO?
None is best on its own merits, because what matters is what you configure. Check that it lets you set a title, description and canonical per page, generates a sitemap on each build, handles trailing slashes the way your host serves them, outputs a real 404.html and prints JSON-LD from front matter. Then check your host: it decides status codes, redirects and whether a host subdomain copy of the site stays online.

Raúl Díaz is the founder of Slibur, the tool that asks ChatGPT, Google AI Overviews, Claude, Perplexity and Grok the questions your customers ask and shows which brands they recommend. He writes about answer engine optimization from the data Slibur collects.