Caching & SEO
How public pages stay fast, fresh and indexable
The public site is built for search engines first: HTML arrives complete, pages are cached, and every page says what it is.
Cache Components
The app uses Next.js Cache Components. Public data functions in src/lib/public-data.ts are marked
"use cache" with a one-hour lifetime and a tag per company (company:slug). The page shell is
prerendered; request-specific parts (the signed-in renter, for instance) stream in inside Suspense.
When staff save inventory, pages, news, settings or an import, the server action calls updateTag for the
company, so the public site shows the change on the next view instead of after an hour.
Metadata and structured data
- Every public page sets a title, description, canonical URL and Open Graph tags.
- The home page carries
LocalBusinessJSON-LD, item pagesProductwith anOffer, and news postsNewsArticle. - Absolute URLs are built from
BETTER_AUTH_URL, so set it to your real origin.
Sitemaps and robots
| URL | Content |
|---|---|
/sitemap.xml | Index of every company's sitemap, rendered per request |
/[company]/sitemap.xml | Home, catalog, news, public items, published pages and news posts |
/robots.txt | Allows the site; blocks /api/, login, signup, invitations and every CMS path |
This site
The home page and documentation are static HTML generated from the site/ folder at build time and
served by the same deployment, so they cost nothing at request time.