Page Revalidation
What is page Revalidation?
If we talk about revalidation, we talk about the following process:
- You publish an entry in Hygraph
- On the shop, that specific page refreshes and fetches the latest content you have just changed
- A full build (website build where all pages are rebuilt) is therefore NOT needed.
When does it (not) apply?
The concept of revalidation only applies to models that have their own page. An entry is one item in such a model: one product, one category, one blog, one content page. Publishing that entry refreshes that page, the page with that entry’s own URL. The models that work this way are listed under Updates on publish.
Revalidation does not apply to content that shows on every page. The mega menu is one example. It sits in the header of the homepage, product pages, category pages, and the rest. Refreshing that on publish would mean rebuilding the whole shop, so a menu change does not update those pages by itself. Message bars are an exception. They update directly even though they show on all pages. See Messagebar.
Check the change on one page first. Publish the menu, then republish one page, for example the homepage. Open that page and look at the menu. When you are happy with it, request a build in Slack #help-commercetools-hygraph. The build refreshes every page, so the menu change shows across the shop. See Request a build.
Publish the pieces the page uses first, then the page. Example: if you want to update the author of a blog, then first save & publish the author, THEN also Save & Publish the blog. This will trigger revalidation of the Blog page, and only then the blog author change is visible on that blog page.
How long does it take to revalidate a page?
Note: after you click Publish, the shop waits about 20 seconds before it refreshes (revalidates) the page. Hygraph needs that moment to finish handing over the new version. If you open the page right away, you will still see the old content.
Models that are revalidated (that update on the shop on Publish)
- Products
- Categories
- Blogs, blog types, and authors
- Content pages and Pages
- Brands, product listings, and product landing pages
- Redirects
Publishing a category updates the category page, not the products in it. Publishing an author updates the author page, not every blog that names them. Etc.
Request a build
The below items are shared on many pages, or they have no page of their own. Publishing one entry does not update them across the shop.
- Header and footer: Menu, Menu Items, logos and USPs in Settings
- Static Words and Static Images
- Tags, badges, labels, and filter sets on product tiles, listings, and search. See Tags, Product Badges and Labels.
- Product feeds
The same applies when one change would mean publishing many pages by hand.
Prices and discounts
Prices and discounts are set in commercetools. The cart, product page, and product tiles pick them up without a Hygraph publish and without a build. When they show, including in product feeds, is covered in Schedule Discounts.
If it does not show
Give it about 20 seconds. If it still does not show, raise a ticket in the IT Support portal.
Builds are requested in Slack #help-commercetools-hygraph. Say if you need staging; otherwise production is assumed. A member of the Nebula team confirms that the build has started. Build status is in #spectrum-builds. Nightly builds also run. See Save, Publish & Schedule.