Approval & site review

Getting a static or Jamstack site approved for AdSense

Last updated Published By the editorial team5 min5 sources

Key takeaways

  • AdSense has no separate rules for static sites: the same eligibility, content and policy review applies to an Astro, Hugo or Eleventy site as to a CMS site.
  • Google requires access to the HTML source so the AdSense code or meta tag can be placed between the <head> and </head> tags, which static generators allow through the base layout.
  • The ads.txt file must be served from the root of the domain you add, which on static generators usually means the public or static folder copied to the build output.
  • On GitHub Pages, a project site lives at <owner>.github.io/<repository>, so its root belongs to a different repository; GitHub also says Pages is not intended to run an online business.
  • Google does not document whether the AdSense crawler executes JavaScript, so content and verification code should be in the prerendered HTML.
A crane above a building construction site
Image: Crane at construction site - geograph.org.uk - 7593527,Kevin Waterhouse,CC BY-SA 2.0,via Wikimedia Commons.

A static or Jamstack site gets reviewed by AdSense exactly like any other site: Google checks ownership, reachability, content and policy compliance, not the stack. What differs is the plumbing: the verification code goes in your base layout, ads.txt goes in the folder copied to the build root, and platform subdomains, preview URLs and client-side rendering can trip the review if you do not plan for them.

What is the same for static sites?

Everything Google evaluates in the review:

  • The applicant must be 18 or older and own the site.
  • The content must be original, sufficient and policy-compliant.
  • The site must be reachable by Google’s crawlers and easy to navigate.
  • The review usually takes a few days and can take 2-4 weeks.

Google’s ownership page states that you “must have access to the HTML source code” and be able to place AdSense code between the <head> tags. Static generators give you that by design, so the technical requirement is easier to meet than on many hosted builders.

What is different on a static or Jamstack site?

Topic Static or Jamstack specifics What to do
Verification code No admin panel; the head comes from a layout or component Add the snippet or meta tag once in the base layout
ads.txt Must be copied to the build root Put it in the passthrough folder (public/, static/)
Domain Free platform subdomains and preview URLs Apply with your production custom domain
Rendering Some frameworks render content client-side Ship content and code in the prerendered HTML
Redirects Trailing-slash and www rules set in platform config Keep one hop to the final URL
Bot protection Platform firewalls or challenge modes Make sure Google’s crawlers are not challenged
Security headers A strict Content Security Policy can block the ad script Allow Google’s ad domains before ads go live

Put the code in the base layout

The goal is a single snippet in the HTML head of every page, as Google asks: “Make sure you place the code on every page you want ads to appear.” In practice:

  • Astro: the shared layout component that renders <head>.
  • Hugo: the head partial included by baseof.html.
  • Eleventy: the base layout template.
  • Next.js with static export: the root layout.

If you are not ready to load the ad script (for example, while you finish consent management), use the meta tag instead. It only proves ownership:

<meta name="google-adsense-account" content="ca-pub-0000000000000000">

Framework-specific code is in AdSense in Astro and AdSense in Hugo and Eleventy.

Make sure the snippet survives the build

Static pipelines can silently drop or alter code:

  1. HTML minifiers or optimizers may move, defer or strip scripts. Check the built HTML, not the source template.
  2. Environment guards (only render the snippet when NODE_ENV === "production") are good practice, but confirm that the production build actually includes it.
  3. Run a quick check against the deployed site:
curl -s https://example.com/ | grep -c "ca-pub-"
curl -sI https://example.com/ads.txt

The first command should return at least 1. The second should return HTTP/2 200 (or HTTP/1.1 200) with a text content type, with no redirect to another host.

Serve ads.txt from the root

Google says to upload the ads.txt file “to your site’s root directory”. On a static site, that means placing it in the folder that is copied as-is to the output root, then deploying. Host-specific pitfalls (rewrites, caching, wrong content type, single-page-app fallbacks that return the homepage instead of a 404) are covered in ads.txt on Netlify, Vercel, Cloudflare Pages and GitHub Pages.

Platform subdomains, previews and GitHub Pages

Apply with the production domain

Jamstack hosts generate extra URLs: preview deployments, branch deployments and the default platform subdomain next to your custom domain. Apply with the one canonical production domain, and make sure the other URLs either redirect to it or are not linked publicly, so the reviewer and visitors see one site.

Free platform subdomains

github.io, netlify.app, vercel.app, pages.dev and web.app all appear on the Public Suffix List, which means browsers treat yoursite.netlify.app as its own registrable domain. How AdSense handles domains, subdomains and hosted platforms is covered in root domain vs subdomain vs subdirectory. A custom domain avoids the question entirely, and it keeps your site, ads.txt and approval history if you change hosts.

GitHub Pages specifics

GitHub’s documentation describes two kinds of Pages sites:

Type Default location Who controls the root
User or organization site https://<owner>.github.io That site’s repository
Project site https://<owner>.github.io/<repository> Not the project; the root belongs to the user site repository

A project site therefore cannot serve /ads.txt from its own repository at the root of <owner>.github.io. Use a custom domain for the project instead.

GitHub also sets a usage limit worth reading before monetizing: GitHub Pages “is not intended for or allowed to be used as a free web-hosting service to run your online business, e-commerce site, or any other website that is primarily directed at either facilitating commercial transactions or providing commercial software as a service”. Check GitHub’s terms against your plans, or host the monetized site elsewhere.

Rendering: does the crawler see your content?

Google’s AdSense crawler pages describe what the crawler does (it reads pages to provide relevant ads, honors robots.txt, sends no POST data) but do not state whether it executes JavaScript. Treat client-side rendering as a risk:

  • Static generation (Astro, Hugo, Eleventy, Next.js static export) puts the full text in the HTML. This is the safe default.
  • Single-page apps that fetch article text after load may present an almost empty HTML shell. Use static or server rendering for content pages.
  • “Islands” or hydrated components are fine as long as the main text is in the HTML.

Google’s crawler troubleshooting also flags two patterns common in Jamstack setups: pages that require POST data (“use GET requests where possible”) and URLs with parameters that make the same content look like new pages, such as session IDs.

Common mistakes on static sites

  • Applying with the *.netlify.app or *.vercel.app URL and then moving to a custom domain. The custom domain is a different site for AdSense; add it and get it reviewed.
  • Single-page-app fallback rules that return index.html with status 200 for every unknown path, including /ads.txt before the file exists. Missing pages should return 404.
  • Thin generated pages. Static generators make it easy to output thousands of tag, taxonomy and pagination pages. Disable or noindex those you do not need; the review may cover all pages.
  • Platform password protection left on from staging. Remove it on the production domain before requesting review.
  • A strict Content Security Policy that blocks the AdSense script. Verification by meta tag or ads.txt still works, but ads will not load later.
  • Leaving demo content from a starter theme, which reads as “under construction”.

Once the plumbing is right, the review is about content: the approval checklist applies unchanged.

Frequently asked questions

Can a static site built with Astro, Hugo or Eleventy get AdSense approval?

Yes. Google's requirements are about access to the HTML, original content and policy compliance, not about the technology. A static generator gives you full control of the HTML head, which is exactly what Google asks for. The review then judges the content the same way it judges a WordPress or custom site.

Where do I put ads.txt on a static site?

In the folder your generator copies unchanged to the root of the build output: public/ in Astro and Eleventy setups that use it, static/ in Hugo, or the configured passthrough folder. After deploying, check that https://yourdomain/ads.txt returns the file directly with a 200 status and no redirect to another host.

Can I apply with a site on github.io, netlify.app or vercel.app?

These platform domains are all on the Public Suffix List, which means each site is treated as its own registrable domain by browsers. Whether you can add one depends on AdSense's site rules at the time you apply. In practice, a custom domain removes the question, gives you a root for ads.txt and keeps your site if you change hosts.

Does AdSense render my client-side JavaScript content?

Google's AdSense crawler documentation does not say whether it executes JavaScript. Do not rely on it. Make sure article text, navigation and the verification snippet are present in the HTML the server returns, which is the default for static generators and for frameworks using static or server rendering.

Sources

  1. Connect your site to AdSense · Google AdSense Help
  2. Owning the site you want to use to participate in AdSense · Google AdSense Help
  3. Fix AdSense crawler issues · Google AdSense Help
  4. What is GitHub Pages? · GitHub Docs
  5. GitHub Pages limits · GitHub Docs