Skip to content
Tutorials Center
My learning

Topics

Lesson 6 of 40 ยท Catalog and Products

Product Pages, Media and Content

Build better product pages: responsive image sets, alt text, descriptions, specification tables, review summaries, structured content and page performance.

The product page is where a visitor decides. They cannot touch the item, so the page has to stand in for the shop floor: clear photos, honest descriptions, the facts that matter and social proof. It is also the page that search engines, ads and social links send most traffic to, so it must be fast on a phone with a weak connection.

This lesson covers the media and content of a product page: image sets and responsive images, alt text, descriptions and specifications, displaying reviews, structured content, and the performance rules that protect conversion. The data model behind the page is in Product Catalogs and Data Modeling and Variants and Options.

What a product page contains

flowchart LR
    G["Gallery<br/>(images, video, zoom)"] --- B["Buy box<br/>(title, price, options,<br/>stock, add to cart)"]
    B --> D["Description<br/>and highlights"]
    D --> S["Specifications"]
    S --> R["Reviews and Q and A"]
    R --> X["Related products"]

A typical top-to-bottom order. The gallery and buy box sit side by side on wide screens.

Everything above the fold should answer four questions fast: what is it, what does it cost, is it available, and what happens when I click "Add to cart"? Details, reviews and related items can load below.

Images and media

Photos sell products. A good set usually contains:

  • A main image on a plain background that shows the whole item.
  • Alternative angles and detail shots (texture, label, ports, stitching).
  • Context shots showing scale or use. A backpack on a person says more than its dimensions.
  • Optionally video or a 360-degree/3D view for complex products.

Tie images to variants. When the customer chooses "Red", the gallery should switch to the red photos. Store an ordered list of images per product, with a flag for which variants each image belongs to, and make the first image the one used in listings, search results and social sharing.

Responsive images

A phone does not need a 3000-pixel-wide photo. The browser can choose from several sizes if you describe them with srcset and sizes:

HTML
<img
  src="/media/tee-red-800.webp"
  srcset="/media/tee-red-400.webp 400w,
          /media/tee-red-800.webp 800w,
          /media/tee-red-1600.webp 1600w"
  sizes="(min-width: 900px) 50vw, 100vw"
  width="800" height="800"
  alt="Red cotton t-shirt, front view"
  fetchpriority="high">
  • srcset lists the available files and their real widths in pixels.
  • sizes says how wide the image will be displayed, so the browser can pick the best file before layout is known.
  • width and height reserve the space so the page does not jump when the image loads (this protects the layout-shift score).
  • fetchpriority="high" is for the main image only, the one most likely to be the largest visible element.
  • Images below the fold should use loading="lazy"; the main image must not be lazy-loaded.

Generate the sizes once, when the merchant uploads the file, and serve modern formats such as WebP or AVIF with a fallback. Serving the images through a CDN keeps them fast worldwide.

JS Generate a srcset

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Alt text

Every product image needs useful alt text. It serves people using screen readers, shows when the image fails to load, and gives search engines context.

  • Describe what is in the picture and relevant to a buyer: "Red cotton t-shirt, front view", not "image1.jpg" and not "buy cheap red t-shirt best price".
  • Keep it short (a sentence at most) and do not start with "Image of".
  • Do not repeat the same text for every angle; "back view" and "close-up of collar label" differ.
  • Purely decorative images get an empty alt="" so assistive technology skips them.

Descriptions and structured content

A wall of text rarely converts. Break content into layers:

  1. A one-line summary under the title.
  2. A short list of highlights (three to six bullets with the facts a buyer checks first).
  3. A description that explains use, fit and benefits in plain language.
  4. A specifications table: size, weight, materials, compatibility, care.
  5. Supporting content such as size guides, shipping and returns information.

Store these as separate fields, not as one blob of HTML. Separate fields let you reuse the highlights in search results and feeds, translate parts independently, validate required specs, and redesign the page without editing thousands of descriptions. If merchants do edit rich text, sanitize it on save, because that HTML will be shown to every visitor and must not contain scripts.

Write for the buyer: lead with what the item does for them, and be specific. Measurements, materials and compatibility prevent returns, and honest information is a legal requirement in many places.

Specifications

Specifications work well as a two-column table generated from typed attributes. Group them (Dimensions, Materials, Power) and format values with their units. The same data feeds comparison tables and the category filters. See the search lesson for Product Search, Filters and Facets.

Showing reviews

Reviews are the strongest trust signal on the page. Display:

  • An average rating and the number of reviews, near the title so it is visible without scrolling.
  • A distribution (how many five-star, four-star and so on). A product with a 4.2 average is judged differently when it comes from forty reviews than from three.
  • Individual reviews with date, reviewer name (or initials), and a "verified purchase" badge if you can confirm the buyer actually ordered it.
  • Sorting and filtering by rating or recency.

Be careful with the maths and with honesty. Compute the average from stored counts, and never hide negative reviews or invent reviews; fake or filtered reviews are illegal in many jurisdictions. Moderation should remove abuse and spam, not criticism.

JS Review summary

Press Run (or Ctrl + Enter) to see the console output here.

No output.

For a very small number of reviews, an average is noisy. Many shops show it only after a minimum count, or show the count prominently so shoppers can judge it themselves.

Structured data and rich content

Search engines understand products best when you describe them in machine-readable form, using JSON-LD with the schema.org Product type. This is what enables price, availability and star ratings in search results. The SEO for Online Shops lesson builds it step by step. The point to remember here is that the visible page and the structured data must agree: the same price, the same availability, the same rating.

Page performance

Product pages carry heavy content, and speed directly affects sales. Focus on the metrics search engines measure as Core Web Vitals:

  • Largest Contentful Paint (LCP). Usually the main product image. Optimize it: right size, modern format, fetchpriority="high", no lazy loading, served from a CDN.
  • Cumulative Layout Shift (CLS). Reserve space for images, the price and any banners so the layout does not jump.
  • Interaction to Next Paint (INP). Keep JavaScript light. Defer third-party scripts such as chat widgets and review widgets, and avoid blocking the "Add to cart" button on them.

Practical habits that help:

  • Render the page on the server so content is visible before scripts run.
  • Cache product pages at the edge, and load only the personal bits (cart count, account) separately.
  • Lazy-load below-the-fold images, review lists and recommendation carousels.
  • Set a performance budget (for example, total image weight above the fold) and check it in your build or monitoring.

Warning: Never lazy-load the main product image or hide it behind a script that builds the gallery after load. That single mistake often makes the Largest Contentful Paint several seconds slower.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What do width and height attributes on an <img> help prevent?

    They let the browser reserve the right amount of space before the file arrives, so content below does not jump.
  2. 2. Which alt text is best for the front photo of a red t-shirt?

    Good alt text describes the picture concisely for someone who cannot see it, without keyword stuffing.
  3. 3. Why store highlights, description and specifications as separate fields?

    Structured fields can feed search results, feeds and comparison tables and are easier to validate than one blob of HTML.
  4. 4. Which image should NOT be lazy-loaded?

    The main image is usually the Largest Contentful Paint element. Delaying it makes the page appear slow.

Summary

  • A product page answers what, how much, is it available and what happens next, then adds depth below.
  • Use image sets tied to variants, responsive srcset/sizes, explicit dimensions and a high-priority main image.
  • Write short, descriptive alt text; use empty alt only for decorative images.
  • Split content into summary, highlights, description and typed specifications, and sanitize any rich text.
  • Show average rating, review count and distribution honestly, and keep structured data consistent with the page.
  • Protect Core Web Vitals: optimize the main image, reserve space, defer third-party scripts and cache at the edge.

Next: Inventory Tracking, where you track what is actually on the shelf.