Open Graph properties of widgets
You can configure the display of Open Graph content items only for a particular MVC widget.
For example, configure only the News items that are displayed on a particular page, by a particular News MVC widget.
To do this, perform the following:
- Open the page where the widget that you want to configure is located.
- Open the widget designer, by clicking Edit.
This must be an MVC widget. - Navigate to the advanced properties, by clicking Advanced.
- Click MetadataFields.
- In OpenGraphTitle, enter a name of a field that belongs to the module.
For example, enterTags
This way, theOpenGraphTitlewill be populated with the Tagsof the content item. - In OpenGraphDescription, enter a name of a field that belongs to the module.
For example, enterSummary
This way, theOpenGraphDescriptionwill be populated with the summary that you created for the content item. - In OpenGraphEnabled, enter
true
This setting enables and disables the OpenGraph fields of the particular widget. - In OpenGraphImageor OpenGraphVideo, enter one of the following:
- A a link to the image or the video that you want to represent the content item.
It can be a link to an image or video from a Sitefinity CMS library or any other link to a media item. - A name of the field that belongs to the module and stores an image or video. The field can be either Short Text or Related media field of type Imageor Video.
- A a link to the image or the video that you want to represent the content item.
- Click Save.
Association of Open Graph fields and module fields
- If you leave OpenGraphTitle field empty, Sitefinity CMS adds meta property
og:titleand takes its value from the Titlefield of the static content item or from the identifier field of a dynamic content item. Otherwise, theog:titleproperty is populated with the contents of the field that you have entered in OpenGraphTitle field. - If you leave OpenGraphDescription field empty, Sitefinity CMS checks whether the content type has a custom field named Description.
- If the content type has a custom field named Description, but it is empty, Sitefinity CMS does not add a meta property
og:description. - If the content type has a custom field named Descriptionand it is filled out, Sitefinity CMS adds meta property
og:descriptionand takes its value from what you have entered in Descriptionfield.
- If the content type has a custom field named Description, but it is empty, Sitefinity CMS does not add a meta property
- If you leave
OpenGraphImageorOpenGraphVideofields empty, Sitefinity CMS does not add an Open Graph image or video meta property.
Priorities of loading OpenGraph properties on pages
If on a page you have more than one widget displaying an item in details mode, by default, the page loads the OpenGraph properties of the last widget - the widget that is ordered last in the HTML of the page.
You can control whose OpenGraph properties to load, by enabling and disabling the OpenGraph properties of the widgets on a particular page.
To do this, in OpenGraphEnabled field, enter true or false, respectively.
EXAMPLE: You have a page displaying a blog post and after the blog post, the page also displays a news item in detailed mode. By default, the OpenGraph properties of the News widget will be loaded for this page.
If you want to display the properties of the Blog post widget, in the OpenGraphEnabled field of the News widget, enterfalseand in the OpenGraphEnabled field of the Blog posts widget, entertrue
NOTE: If you want to display the OpenGraph properties of the page, where the widgets in detail view are located, you must disable the OpenGraph fields for all widgets on that particular page. This way, the OpenGraph fields of the page will be loaded.