Skip to content
Login Contact

How does Marfeel detect images and videos in an article?

Marfeel detects images and videos in every article to power four capabilities:

  1. Display the main image of an article in Compass view
  2. Compute Image count
  3. Compute Video count
  4. Provide the main video for use in Amplify

The detection relies on three sources of editorial metadata: LD+JSON structured data, Microdata, and Open Graph meta tags.

Marfeel selects the main image through a waterfall process, stopping at the first successful match:

  1. LD+JSON data (For more details visit https://schema.org/image):
    <script type="application/ld+json">
    {
    "@context": "https://schema.org",
    "@type": "NewsArticle",
    "image": "mainImage.jpg"
    }
    </script>
  2. Microdata
    <img itemprop="image" src="https://domain.com/path/to/img.jpg">
  3. Or from Meta OG types (supports both property and name attributes):
    <meta property="og:image" content="https://mywebsite.com/images/mainImage.jpg" />

Marfeel calculates the number of images in an article by taking the maximum value among the following counts:

  1. Count the relevant ImageObject in LD+JSON, only from image and associatedMedia entity attributes.
  2. Count the image in Microdata
  3. Count the <img> nodes from a cleaned XPath DOM.
{
"@type": "ImageObject",
"url": "mainImage.jpg",
"width": { // Optional
"@type": "QuantitativeValue",
"value": 1000
},
"height": { // Optional
"@type": "QuantitativeValue",
"value": 1000
},
"name": "Image title", // Optional
"author": { // Optional
"@type": "Person",
"name": "Photographer name"
}
}

Marfeel calculates the number of videos in an article by taking the maximum value among the following counts:

  1. Count the relevant VideoObject in LD+JSON, only from video and associatedMedia entity attributes.
  2. Count the video in Microdata
  3. Count the <video> nodes from a cleaned XPath DOM.

Marfeel selects the main video through the same waterfall approach used for images:

  1. LD+JSON video field (For more details visit https://schema.org/video):
    <script type="application/ld+json">
    {
    "@context": "https://schema.org",
    "@type": "NewsArticle",
    "video": {
    "@type": "VideoObject",
    "contentUrl": "https://example.com/video.mp4",
    "embedUrl": "https://example.com/embed/video",
    "thumbnailUrl": "https://example.com/thumb.jpg"
    }
    }
    </script>
  2. Microdata
    <video itemprop="video" src="https://domain.com/path/to/video.mp4">
  3. Or from Meta OG types (supports both property and name attributes):
    <meta property="og:video" content="https://mywebsite.com/videos/mainVideo.mp4" />

The video URL preference order is: contentUrl > embedUrl > url. When available, the video thumbnail (thumbnailUrl) is also extracted.

If images or videos are not detected as expected, check the multimedia troubleshooting guide for common issues and fixes.

How does Marfeel determine the main image of an article?

Marfeel uses a waterfall process: it first checks LD+JSON structured data for a schema.org image property, then falls back to Microdata (itemprop=“image”), and finally checks Open Graph meta tags (og:image). The first match wins.

How does Marfeel count images and videos in an article?

Marfeel takes the maximum value among three counts: ImageObject or VideoObject entries in LD+JSON, Microdata elements, and actual <img> or <video> nodes found in the cleaned XPath DOM of the article body.

What is the URL preference order for main video detection?

Marfeel prioritizes contentUrl first, then embedUrl, then url. When available, the video thumbnail (thumbnailUrl) is also extracted.