How to keep your product and collection data up to date on your site
This article covers:
- An introduction to publishing on Nyla and why sites sometimes need to be built for data to be up to date
- When Nyla product and collection pages automatically get re-published after changes are made on Shopify
- How to force rebuilds of your site or specific pages
- When a manual publish is necessary for data to be updated
- What data is server side rendered and verified in the browser
- How to tell the last time a page was rebuilt
Introduction
In order to optimize end-user performance, Nyla sites are server-side generated ahead of time.
Server-side generation means that your site's pages are pre-rendered on the server ahead of time before being sent to your users' browsers. This improves end-user performance by delivering pre-rendered pages, resulting in faster loading times and a smoother browsing experience.
However, this also means that when dynamic data updates (for example data pulling from Shopify), if the data is not being pulled in the browser, then the page needs to be rebuilt in order to render that data on the page delivered to the end user.
In Nyla, data that has been changed in a data source can either be:
- Automatically refreshed on some or all pages
- Only updated when a page is rebuilt
- Included in a build, and then validated in the browser
Page data is automatically refreshed if any of the following is changed in Shopify:
Collections:
- Adding or removing products in the collection
Products:
- Price / Compare at price
- Images
- Title
- Description
- Variants added or removed
- Status
In these cases, as soon as the save is completed in Shopify, Nyla receives the information to refresh (or "rebuild") the data on the page. As soon as this information is received, then all of the pages that contain the product in question e.g any pages in which it is included any of the following will be rebuilt:
- Source product
- Page source: product
This generally takes a few moments. If you already have the page open you will need to refresh it to see the updated data. However in some rare edge cases, the automated notice to update the data might not be sent by Shopify or disrupted.
Forcing a Rebuild of a Page or Your Site
Whilst it is very rare that automated publishes fail, in the event that you don't see your pages update automatically, then you can:
- Force a rebuild of a specific page by going to the page settings and clicking "Rebuild Page" (change should appear live in a few moments on this page). This is the best method if you are only updating the data on an individual page.
- Force a rebuild of the entire site by going to your publish screen and clicking "publish" with no changes applied.
Note that pages where the product is featured in a source: collection are not updated automatically, so there may be a discrepancy in the product details on product listing pages until the next site rebuild. In this case, it makes sense to force a site rebuild after making changes to product pages that you want to reflect on source collections (e.g a change to the title, or the product image, or so on).
Only updated when the page is rebuilt:
In these cases, changes on Shopify do not trigger an automatic publish, so in order for the changes to reflect on the site after you have made them in Shopify. You need to manually publish the pages in question (or force a full site rebuild). We recommend manually publishing the pages given the data will generally update more quickly than building the entire site.
Collections:
- Order of products in the collection
Products:
- Any updates to product data in Shopify that is not included in the list of items that trigger an automatic refresh
Data that is server side rendered, then verified in the browser:
- Price / Compare at price
- Metafields (this also includes variant metafields)
- Inventory
This data does not require a rebuild to update, but it does require a brief moment for the site to fetch the data from Shopify. This might result in a minor flicker, for example if a product that was in stock in the last "built" version of the page but is now out of stock, the add to cart button may appear briefly in stock until Shopify returns the data to show it is out of stock.
In order to remove a flicker when data in the build doesn't match to Shopify, simply republish the page or the entire site to update the data included in the build.
How to tell the last time a page was rebuilt
In page settings, you can see the "Page last updated" message at the bottom of page settings to see the last time a page was rebuilt.