Add a meta viewport tag

The viewport meta tag tells mobile browsers to use the device width. Without it, pages render at a virtual desktop width and text becomes unreadable. Add width=device-width, initial-scale=1, do not disable zoom, and verify the tag is in the server response.

highIn codeimpact effort

Why this matters

Without it, mobile browsers pretend the page is a desktop layout.

Get the full breakdown

The extended brief explains when this works, when it does not, and the trade-offs. Join the waitlist and it unlocks for every tip when sign-in opens; MCP access is the paid part.

Join the waitlist

Before you start

  • Access to the root layout or head template

How to apply it

  1. Add the tag to the root layout

    Insert a meta name=viewport tag with width=device-width, initial-scale=1 in the head. Remove any maximum-scale or user-scalable restrictions.

    Check: The layout source contains the viewport meta tag and no user-scalable=no.

  2. Confirm it ships in the response

    Fetch production HTML and search the head. Frameworks that inject head tags client-side will fail this check.

    Check: curl -s your production domain/ | grep -c 'name="viewport"' returns 1.

  3. Check the mobile rendering General best practice

    Open the page at a 390-pixel viewport and confirm text is readable without zooming and no horizontal scroll appears.

    Check: document.documentElement.scrollWidth is less than or equal to 390 at a 390-pixel viewport.

Get the prompt for your agent

A ready-to-paste prompt for your agent that implements this tip and verifies the result in your repo.

Join the waitlist

Source: seo-mcp playbook · curated entry · report an error

Framework notes

nextjs-app

Export `viewport` from the root layout (`export const viewport: Viewport = { width: 'device-width', initialScale: 1 }`); Next.js emits the meta tag server-side.

astro

Add `<meta name="viewport" content="width=device-width, initial-scale=1" />` to the layout head; it is included in the static HTML.

wordpress

Themes normally add the tag in `header.php`; if a plugin strips it, re-add it with `add_action('wp_head', ...)` at priority 1.

Official references

Let your agent apply this + 161 more tips.

Pre-order — $19