Skip to content
Nazmul Nikhil
Menu

Viewport Not Set (Ahrefs): Add the One Tag Mobile Pages Need

Without a viewport meta tag, phones render your page at desktop width and shrink it. Here's the one line to add and where to add it on each platform.

Nazmul Nikhil

By

Head of SEO & Assistant Manager, Digital Marketing at Notionhive

Published 2 min read
Viewport Not Set (Ahrefs): Add the One Tag Mobile Pages Need
Photo: Neil Soni on Unsplash

In short

Ahrefs flags "Viewport not set" when a page has no viewport meta tag. Without it, mobile browsers render the page at a desktop width, around 980px, and shrink it to fit, so text is tiny and the layout breaks. Since Google indexes the mobile version of pages, add this line to the <head> of every page: <meta name="viewport" content="width=device-width, initial-scale=1">.

This is one of the quickest fixes in the whole audit, and one of the most important for mobile visitors.

Why it matters

Google uses mobile-first indexing, so it judges your pages as a phone sees them. A page without a viewport tag is effectively a desktop page on a small screen. Visitors pinch, zoom and leave. A missing viewport tag also causes many of the other mobile issues in this category, like small fonts and small tap targets.

The correct tag

<meta name="viewport" content="width=device-width, initial-scale=1">

Place it inside <head>, once per page. Don't add maximum-scale=1 or user-scalable=no, because they stop people from zooming in, which is an accessibility problem.

Where to add it

WordPress: every modern theme includes it. If it's missing, the theme is very old or a header template was edited. Switch to a maintained theme, or add the tag to the theme's header.php in a child theme.

Shopify: check theme.liquid in Online Store > Themes > Edit code. All current Shopify themes include it.

Webflow: Webflow adds it automatically. If it's flagged, check the page for a custom code embed that overrides the head.

Wix: Wix adds it on its mobile-optimized sites. If it's flagged, check whether the page is served from an old or custom setup.

Custom builds: add it to the shared layout or HTML template so every page inherits it. In React with Vite, put it in index.html. In Next.js, it's added by default.

Common mistakes

  • Adding the tag when the layout isn't responsive. The tag tells the browser to use the screen width. If the CSS uses fixed widths, you'll then see sideways scrolling instead. See "Content is not sized correctly".

  • Duplicate viewport tags from a theme plus a plugin. Keep one.

This guide isn't affiliated with or endorsed by Ahrefs.

Sources and references

TAGSAhrefs Site AuditViewport not setMeta viewport tagViewport meta tag missing
Nazmul Nikhil

About the author

Nazmul Nikhil

Head of SEO & Assistant Manager, Digital Marketing at Notionhive

SEO and AI search consultant in Dhaka, Bangladesh, helping small and mid-size businesses in the USA, UK, Australia and Canada.

Need help with this?

Get it fixed with Mobile SEO

I find the issues that cost you traffic and fix them, starting with the pages that matter most.

Keep reading

Related articles

All Site Audit Issues posts →

Get the next guide in your inbox

One email when a new SEO or AI search guide goes live.

Ready to grow?

Get a free audit of your website, or book a 30-minute call to talk through your goals.

Nazmul Hasan

Talk to Nazmul directly

Reply within 24h

WhatsApp +880 1682835118
nazmulnikhil@gmail.com