Movie Schema Framework

Use conditional-logic schema generation to keep Movie markup aligned with real page state and avoid stale or invalid static templates.

When To Use It

Google Search CentralMovie documentation

Use on a list of movies: either a summary page whose ListItem entries point to movie detail pages, or a single all-in-one page that carries the full Movie data for every item.

Key Implementation Documentation Highlights

  • Availability: the movie carousel is limited to mobile devices and requires an ItemList of movies that follows the carousel guidelines.
  • Required Movie properties: name, image.
  • Recommended Movie properties: aggregateRating, dateCreated, director, review.
  • image must be high resolution, in .jpg, .png or .gif format, crawlable and indexable, with a 6:9 aspect ratio. Google can crop images close to 6:9; images that deviate a lot are not eligible.
  • ItemList: each ListItem needs a position starting at 1 and increasing by 1, plus either url (summary page, pointing to a detail page on the same domain) or item with the full Movie (all-in-one page, item.url is the page URL plus a #anchor). All items must be Movies.
  • dateCreated is the release date in ISO 8601. director is a Person. review and aggregateRating follow the Review snippet guidelines (rating values within bestRating and worstRating).
  • Summary page approach: every detail page carries its own Movie markup with the required properties. Validate with the Rich Results Test before deploying.

Template Approach

const pageData = {
  pageUrl: "https://www.example.com/lists/best-heist-films-2026",
  movies: [
    { anchor: "the-vault-line", name: "The Vault Line", poster: "https://www.example.com/posters/the-vault-line.jpg", released: "2026-02-13", director: "Maya Ortiz" },
    { anchor: "night-transfer", name: "Night Transfer", poster: "https://www.example.com/posters/night-transfer.png", released: "2026-05-08", director: "Daniel Okafor" }
  ]
};

const staticTemplate = {
  "@context": "https://schema.org",
  "@type": "ItemList",
  "itemListElement": pageData.movies.map((m, i) => ({
    "@type": "ListItem",
    "position": i + 1,
    "item": {
      "@type": "Movie",
      "url": pageData.pageUrl + "#" + m.anchor,
      "name": m.name,
      "image": m.poster,
      "dateCreated": m.released,
      "director": { "@type": "Person", "name": m.director }
    }
  }))
};

Conditional-logic Framework

// Shared helpers
const ISO_DATE = /^(\d{4})-(\d{2})-(\d{2})$/;
const ISO_DATETIME = /^(\d{4}-\d{2}-\d{2})T([01]\d|2[0-3]):[0-5]\d(:[0-5]\d(\.\d+)?)?(Z|[+-](0\d|1[0-4]):[0-5]\d)$/;

function isAbsoluteUrl(value) {
  if (typeof value !== "string") return false;
  try {
    const url = new URL(value);
    return (url.protocol === "https:" || url.protocol === "http:") && url.hostname !== "";
  } catch {
    return false;
  }
}

function toIsoDate(value) {
  const match = typeof value === "string" ? ISO_DATE.exec(value) : null;
  if (!match) return null;
  const [y, m, d] = match.slice(1).map(Number);
  const date = new Date(Date.UTC(y, m - 1, d));
  return date.getUTCMonth() === m - 1 && date.getUTCDate() === d ? value : null;
}

// Keeps the original timezone offset; rejects naive or unparseable values.
function toIsoDateTime(value) {
  const match = typeof value === "string" ? ISO_DATETIME.exec(value) : null;
  return match && toIsoDate(match[1]) ? value : null;
}

// Drops null, undefined, "", [] and {} recursively.
function compact(value) {
  if (Array.isArray(value)) {
    const items = value.map(compact).filter((item) => item !== undefined);
    return items.length ? items : undefined;
  }
  if (value !== null && typeof value === "object") {
    const out = {};
    for (const [key, item] of Object.entries(value)) {
      const kept = compact(item);
      if (kept !== undefined) out[key] = kept;
    }
    return Object.keys(out).length ? out : undefined;
  }
  return value === null || value === undefined || value === "" ? undefined : value;
}

// Page gates: indexable, self-canonical, marked-up content visible.
function passesPageGates(page) {
  if (!page || page.noindex || page.robotsBlocked) return false;
  if (!isAbsoluteUrl(page.url)) return false;
  if (page.canonicalUrl && page.canonicalUrl !== page.url) return false;
  return page.contentVisible === true;
}

// Movie helpers
const IMAGE_FILE = /\.(jpe?g|png|gif)$/i;

// 6:9 (2:3) poster ratio; Google can crop images that are close to it.
function isPosterRatio(img) {
  if (!img || !img.width || !img.height) return false;
  return Math.abs(img.width / img.height - 6 / 9) <= 0.05;
}

function buildPerson(name) {
  return name ? { "@type": "Person", name } : null;
}

function buildRating(r, isAggregate) {
  if (!r) return null;
  const best = r.bestRating ?? 5;
  const worst = r.worstRating ?? 1;
  if (typeof r.ratingValue !== "number" || r.ratingValue < worst || r.ratingValue > best) return null;
  if (isAggregate && !(Number.isInteger(r.ratingCount) && r.ratingCount > 0)) return null;
  return {
    "@type": isAggregate ? "AggregateRating" : "Rating",
    ratingValue: r.ratingValue,
    bestRating: best,
    worstRating: worst,
    ratingCount: isAggregate ? r.ratingCount : null
  };
}

function buildReview(review) {
  const rating = buildRating(review && review.rating, false);
  if (!rating || !review.authorName) return null; // review needs author and rating
  return {
    "@type": "Review",
    reviewRating: rating,
    author: buildPerson(review.authorName),
    datePublished: toIsoDate(review.datePublished)
  };
}

// One Movie node. Required: name, image (crawlable .jpg/.png/.gif, about 6:9).
// Summary approach detail page: compact({ "@context": "https://schema.org", ...buildMovieSchema(movie) })
function buildMovieSchema(movie) {
  const images = (movie.images || []).filter(
    (img) => isAbsoluteUrl(img.url) && IMAGE_FILE.test(new URL(img.url).pathname) && isPosterRatio(img)
  );
  if (!movie.name || !images.length) return null;
  return {
    "@type": "Movie",
    url: isAbsoluteUrl(movie.url) ? movie.url : null,
    name: movie.name,
    image: images.map((img) => img.url),
    dateCreated: toIsoDate(movie.releaseDate),
    director: (movie.directors || []).map(buildPerson),
    aggregateRating: buildRating(movie.aggregateRating, true),
    review: (movie.reviews || []).map(buildReview)
  };
}

// Summary page (ListItem.url to detail pages) or all-in-one page (full Movie in each ListItem).
function chooseCarouselApproach(source) {
  return source.movies.every((m) => m.renderedOnThisPage) ? "all-in-one" : "summary";
}

function buildMovieCarouselSchema(source) {
  const page = source.page;
  if (!passesPageGates(page) || !Array.isArray(source.movies) || !source.movies.length) return null;

  const approach = chooseCarouselApproach(source);
  const host = new URL(page.url).hostname;
  const entries = [];
  for (const movie of source.movies) {
    // Every item must be a Movie on the same domain as the list page.
    if (!isAbsoluteUrl(movie.url) || new URL(movie.url).hostname !== host) continue;
    if (approach === "summary") {
      entries.push({ url: movie.url });
      continue;
    }
    // All-in-one: each item needs its own URL fragment on this page.
    if (!movie.url.startsWith(page.url + "#")) continue;
    const node = buildMovieSchema(movie);
    if (node) entries.push({ item: node });
  }
  if (!entries.length) return null;

  return compact({
    "@context": "https://schema.org",
    "@type": "ItemList",
    // Positions start at 1 and increase by 1 after filtering.
    itemListElement: entries.map((entry, i) => ({ "@type": "ListItem", position: i + 1, ...entry }))
  }) ?? null;
}

// Usage:
// const source = {
//   "page": {
//     "url": "https://www.example.com/lists/best-heist-films-2026",
//     "canonicalUrl": "https://www.example.com/lists/best-heist-films-2026",
//     "noindex": false,
//     "contentVisible": true
//   },
//   "movies": [
//     {
//       "renderedOnThisPage": true,
//       "url": "https://www.example.com/lists/best-heist-films-2026#the-vault-line",
//       "name": "The Vault Line",
//       "images": [
//         {
//           "url": "https://www.example.com/posters/the-vault-line.jpg",
//           "width": 1200,
//           "height": 1800
//         }
//       ],
//       "releaseDate": "2026-02-13",
//       "directors": [
//         "Maya Ortiz"
//       ],
//       "aggregateRating": {
//         "ratingValue": 4.4,
//         "bestRating": 5,
//         "worstRating": 1,
//         "ratingCount": 1287
//       },
//       "reviews": [
//         {
//           "authorName": "Sam Patel",
//           "datePublished": "2026-02-20",
//           "rating": {
//             "ratingValue": 5,
//             "bestRating": 5,
//             "worstRating": 1
//           }
//         }
//       ]
//     },
//     {
//       "renderedOnThisPage": true,
//       "url": "https://www.example.com/lists/best-heist-films-2026#night-transfer",
//       "name": "Night Transfer",
//       "images": [
//         {
//           "url": "https://www.example.com/posters/night-transfer.png",
//           "width": 1000,
//           "height": 1500
//         }
//       ],
//       "releaseDate": "2026-05-08",
//       "directors": [
//         "Daniel Okafor"
//       ],
//       "aggregateRating": {
//         "ratingValue": 3.9,
//         "bestRating": 5,
//         "worstRating": 1,
//         "ratingCount": 642
//       },
//       "reviews": [
//         {
//           "authorName": "Lena Fischer",
//           "datePublished": "2026-05-15",
//           "rating": {
//             "ratingValue": 4,
//             "bestRating": 5,
//             "worstRating": 1
//           }
//         }
//       ]
//     }
//   ]
// };
// const schema = buildMovieCarouselSchema(source);

The Output As An Entity Graph

The conditional-logic output above, parsed in your browser and drawn as the graph a crawler builds from it. Every nested object is a node and the property that holds it is the edge. Tap a node to inspect its properties, or drag to rearrange.

Why Conditional Logic Is Better Than Static Templates

  • Prevents emitting empty, null, or stale fields that frequently trigger rich result warnings.
  • Supports multiple page states (for example: no rating yet, no image yet, no offers yet) without duplicate templates.
  • Lets engineering teams centralize schema policy checks and validation in reusable code paths.
  • Makes large-scale schema maintenance safer when content models evolve over time.

Property Reference

What Google's Movie carousel documentation requires and recommends, property by property. These are the same rules the SchemaCDN validator checks. Each name links to its schema.org definition.

Availability: The movie carousel is only available on mobile devices.

Movie carousel properties in Google's documentation
PropertyGoogleExpectsNotes
imageRequiredURL or ImageObject, can repeatA high-resolution 6:9 image that represents the movie. Aspect ratios: 6x9.
nameRequiredTextThe name of the movie.
aggregateRatingRecommendedAggregateRatingThe average review score for the movie.
dateCreatedRecommendedDate or DateTimeThe movie's release date.
directorRecommendedPerson, can repeatAs a Person.
reviewRecommendedReview, can repeatA nested Review of the movie.

Explore Other Schema Framework Pages

Organization Use for official organization pages to clarify brand identity and authoritative entity signals. Organization Open Retired Practice Problems Use for educational practice content that presents solvable problems and answer validation structure. Quiz Open Product Snippet Use for product pages where pricing, availability, and product identity are visible to users. Product Open Product Variants Use when one product comes in variants such as size or color, grouped with ProductGroup. ProductGroup Open Profile Page Use for creator or contributor profile pages where identity attributes and ownership are explicit. ProfilePage Open Q&A Use for pages where users submit questions and community or editorial answers are displayed. QAPage Open Recipe Use for recipe pages with complete ingredients, instructions, and preparation details. Recipe Open Return Policy Use to publish a merchant return policy once at the organization level, with offer-level overrides. MerchantReturnPolicy Open Review Snippet Use when a page publishes genuine reviews tied to a clearly identified product, service, or entity. Review Open Shipping Policy Use to publish shipping rates, delivery times and destinations once at the organization level. ShippingService Open Site Name Use on the home page so Google shows the preferred site name in search results. WebSite Open Retired Sitelinks Search Box Use on sites with a functioning internal search endpoint that can accept URL query parameters. WebSite Open Software App (Beta) Use for software product pages that describe platform support and application category clearly. SoftwareApplication Open Limited Speakable Use for news-style pages where specific text segments are appropriate for text-to-speech playback. SpeakableSpecification Open Subscription and Paywalled Content Use for pages with restricted sections so Google can distinguish free previews from protected content. CreativeWork Open Limited Vacation Rental Use for rental property detail pages where booking-relevant amenities and location signals are explicit. VacationRental Open Retired Vehicle Listing Use for inventory pages selling vehicles with standardized listing fields and offer information. Car Open Video Use for pages where a primary video is embedded and key media metadata is visible on-page. VideoObject Open Article Use for editorial pages where the visible content is a complete article with a clear byline and publication timestamps. Article Open Limited Book Actions Use when your page helps users read, preview, or purchase books through clearly described actions. Book Open Breadcrumb Use on pages that belong to a clear hierarchy and display navigational trail links users can follow. BreadcrumbList Open Carousel Use when a page lists multiple related entities in a scannable sequence that can be surfaced as cards. ItemList Open Course Use for educational offerings where curriculum details, provider identity, and delivery context are explicit. Course Open Dataset Use for dataset landing pages so datasets are discoverable in Google Dataset Search with license, creator and download details. Dataset Open Discussion Forum Use for forum and community threads where a primary post and subsequent replies are publicly visible. DiscussionForumPosting Open Limited Education Q&A Use for educational question-answer pages where a single canonical answer and supporting context are visible. Quiz Open Employer Aggregate Rating Use on pages that publish employer rating aggregates from a clear and policy-compliant review source. EmployerAggregateRating Open Retired Estimated Salary Use for compensation insight pages that present transparent salary ranges for specific occupations and locations. Occupation Open Event Use for upcoming events with a real-world or virtual occurrence, schedule, and location context. Event Open Retired Fact Check Use for fact-checking pages that evaluate a specific claim with a transparent rating methodology. ClaimReview Open Retired Home Activities Use for virtual classes and activities where participation details and timing are clearly listed. Event Open Retired How-To Use for instructional content that teaches a process through ordered steps and actionable detail. HowTo Open Image Metadata Use on image pages and image hosts that expose ownership and licensing information to search engines. ImageObject Open Job Posting Use for active job listings that include role details, hiring entity, and location/salary context. JobPosting Open Retired Learning Video Use for educational videos where the learning objective and pedagogical structure are explicit. LearningResource Open Local Business Use for physical businesses serving local customers with publicly verifiable contact and location details. LocalBusiness Open Loyalty Program Use to publish a loyalty program and its tiers once at the organization level, so member prices and member shipping can reference them. MemberProgram Open Math Solvers Use for pages that solve mathematical expressions and present step-by-step computational guidance. MathSolver Open Merchant Listing Use on pages where a product can be bought, with price, availability, shipping and return details. Product Open

Implement Movie Schema Frameworks Correctly

Get implementation support for conditional schema architecture, validation, and deployment governance.