1

I am trying to create a JSON view in Site Pages that displays News Items in a nice way. Is there a way to display the thumbnail image in it? What is the name of that property/column?

Thanks for any advice.

Edit:

I am using List View and I am trying to display the thumbnail that is associated with a particular News Item:

{
            "elmType": "img",
            "style": {
              "width": "105px",
              "height": "70px"
            },
            "attributes": {
              "src": "[$Image]"
            }

Thought something along these lines would work, but it does not. Can this thumbnail be referenced like this?

When you add a News Item, and then go into Page Details you have the option to select a page thumbnail which is then displayed in Search Results/News web parts/Highlighted Content Web parts.

I am trying to display this image with JSON in the Page Library view I am customizing.

1
  • Are you using Gallery view? Do you have Image column or you are trying to fetch the image from news page content? can you please the current JSON code you have? – Ganesh Sanap Mar 29 at 8:50
1

You can get the thumbnail image URL in JSON formatting using [$BannerImageUrl].

Example:

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "img",
  "attributes": {
    "src": "[$BannerImageUrl]"
  }
}

Output:

enter image description here


Note:

In order to use this image URL in JSON, you have to include the "Banner Image URL" column in your Site pages library view. For that follow below steps:

  1. Go to Site pages library
  2. Click on Add column

enter image description here

  1. Select Show/hide columns
  2. Select "Banner Image URL" from list & click Apply

enter image description here

Now, you can refer the thumbnail image URL anywhere in your JSON code using [$BannerImageUrl].

0

Where is the image you want to use as thumbnail? Thumbnails are only available for a list of supported file formats. Are you trying to use external images as thumbnail in the Site Pages library?

Here is an official reference concerning thumbnail.

And provide more information about your task will help other community members to get your idea and find a way for you.

1
  • When you add a News Item, and then go into Page Details you have the option to select a page thumbnail which is then displayed in Search Results/News webparts/Highlighted Content Webparts. I am trying to display this image with JSON in the Page Library view I am customizing. – Szymciak Mar 29 at 9:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.