Limits
Six things are outside the package. Each one is a decision the app or the host makes, and the docs say so instead of hiding it.
The server-rendered image
expo-image mounts its image in an effect, so a static export has no <img>
element, and the React Native Image writes none either: on the web it
starts idle, loads the source in an effect, and writes its hidden <img>
only for defaultSource. A crawler that runs no script sees no image and
no alt.
Picture from @rootnative/seo/expo-image closes the gap. On the web it
renders a plain <img> with src, alt, width and height, so the
crawler sees a visible image with its size, and the page reserves the box
before the image loads. On native it renders expo-image. Its source is
absolute or a path under the site URL, like image in PageHead. The
cost: the web side takes no expo-image feature. A page that needs caching
or a transition on the web keeps expo-image there, with the two fallbacks
that carry the image to a crawler:
og:imagein the head. Every share card reads it, and so does Google Images for the page.- The
imagefield of the JSON-LD. Every builder takes one.
Set both on every page that has an image, with or without Picture.
The host 404
A static export writes one file per route it knows. A dynamic route with no
generateStaticParams writes no file, and the host returns a 404 for it. A
host with no rewrite rule serves a 404 for every unknown path.
No package changes that. Check the host:
- GitHub Pages serves
404.htmlfor an unknown path, and a script in that file can redirect to the app. A crawler still receives the 404 status. - Netlify, Vercel, and Cloudflare Pages take a rewrite rule that serves
index.htmlwith a 200 for an unknown path. - A dynamic route with real data needs
generateStaticParamsand a data source the export server can reach. - With
web.output: 'server', the server sends the 404 for an unknown path, on any host. It sends a dynamic route template with a 200 for every slug, so an unknown entry needsnoindex. See server output.
The charset position
The HTML spec requires the <meta charset> in the first 1024 bytes of the
page. shellTags writes it first in the shell, but on Expo SDK 57 Expo
Router writes the PageHead tags at the start of <head>, before the shell.
A page with a title, a description and the Open Graph tags puts the charset
after byte 1024. The home page of the example app is one such page.
On SDK 57 no package changes that order. From SDK 58 the shell places the
generateMetadata tags where it renders headNodes, so a shell that renders
them after shellTags keeps the charset first. On both, the host should send
the charset in the Content-Type header, because the header wins over the
tag:
- GitHub Pages sends
text/html; charset=utf-8for an.htmlfile. - A host that sends
text/htmlwith no charset, or noContent-Type, makes the browser guess the encoding. Check the header withcurl -I <url>.
The per-route noindex decision
The package writes the tag. The app decides which routes carry it. The usual set:
- An overlay or a sheet that has a route of its own.
- A screen that exists for one device class, such as a compact-only menu.
- A page that shows the same content as another URL, when a canonical link to the other URL is not enough.
Give the route noindex and no url. Don't list it in robots.txt: a
crawler reads the noindex tag only on a page it may fetch, and a
Disallow line leaves the URL in the index with no title.
The page language
Expo Router writes the <html> element of app/+html.tsx on every page,
and from Expo SDK 58 the render changes no attribute of it: Metadata has
no field for lang, and the renderer applies no <html> attribute from a
page. So every page leaves the export with the lang of the shell, and the
German version of an English site says lang="en". Google takes the
language of a version from its hreflang links, not from lang. A screen
reader and some other search engines read lang.
The package sets the lang of a page in another language in two places:
rootnative-seo distreads the language of each page from its head, thehreflanglink to itself or elseog:locale, and setslangon<html>in the file when it names another language than the shell.--no-langleaves the files as they are.PageHeadandRouteHeadsetlangon<html>after hydration and after a client navigation, and put thelangof the shell back when the page goes.pageLang(site, meta)from the core returns the value they use, for a template of your own.
A page in the language of the shell keeps the lang of the shell: en
stays en on a page with og:locale en_US. rootnative-seo audit fails
a page of a static export whose lang is not the language of the page.
Two limits stay. A server export (web.output: 'server') renders each page
at request time, so no file holds the page: the first paint has the lang
of the shell, and the page sets its own after hydration. And a <html>
element inside <Head> from expo-router/head does nothing in an SDK 58
export; don't add one.
The checks that count
The unit tests and the export check prove that the tags reach the HTML. They don't prove that a crawler indexes the page. Two checks do, and both run on the live host only:
- Lighthouse in Chrome, on the deployed URL. The SEO audit reads the
title, the description, the canonical link, the
<h1>, and the link targets, from the HTML the host serves. Make it a gate: run it after each deploy and fail the workflow below 100. The deploy workflow of this site does, with one script that takes the URLs; the GitHububuntu-latestrunner has Chrome. The workflow busts the Pages edge cache with a query string, because the edge can serve the previous deploy for ten minutes. Lighthouse audits the DOM after the script ran, not the served file: the client-side head rewrites the title and the canonical link, so a defect in the HTML file still scores 100 here.rootnative-seo auditreads the file and is the gate for that; Lighthouse catches what the host adds or blocks, such as anoindexor arobots.txtrule. - Google Search Console, with the sitemap submitted. The URL inspection
tool shows the page as Google rendered it, and the coverage report shows
the routes it indexed and the ones it did not. This step stays manual:
verify the property once, then submit
<siteUrl>/sitemap.xml, the filerootnative-seowrites. A site under a subpath submits its own sitemap URL, and the root site lists every sitemap inrobots.txt.
A green export check and a red Search Console report means the host, not the head. Start with the status code of the URL.