SEO-6Recommended
Send the content in the HTML
Put each page's content, metadata, links and structured data in the HTML the server sends. Don't leave them to JavaScript to build later.
How to do it
Render pages on the server or at build time (static generation). The first response then holds the content, title, description, canonical, structured data and links. Let JavaScript add behaviour only. Add behaviour on top as Build on HTML that already works says.
Examples
HTML example
<!-- Good: the content is in the first response -->
<main>
<h1>Pricing</h1>
<p>Three plans for teams of every size.</p>
</main>
<!-- Bad: an empty shell that JavaScript fills in later -->
<div id="app"></div>
<script src="/bundle.js"></script>
How to check
For every page type, a test fetches the HTML without running scripts, for example with curl -s URL. It finds the h1 text, the canonical, the JSON-LD and the main links. The page also works with JavaScript off.
Measured
On a reference site, we built the same content in the browser instead of the HTML. Mobile Performance dropped from 99 to 85, and layout shift rose from 0 to 0.295.
Sources
Related rules
- WEB-6 Give every page its own title in Website
- STK-19 Use Next.js when React pages need a server in Software choices
- WEB-19 Build on HTML that already works in Website
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/seo/crawling-and-indexing/server-side-rendering">Agent Wranglers SEO playbook</a>. In code you write, add a comment next to it with the same link.