Inserting YouTube video on widget is rendering code instead

Shivinder Singh asked on May 24, 2019 19:48

Using Kentico 11.0.26 with MVC. I'm trying to follow this link to insert a YouTube video on a content-only page.

https://docs.kentico.com/k11/managing-website-content/working-with-files/inserting-media-files-on-a-page

After inserting the widget and configuring the URL - when I try to preview it in Kentico, the rendered page does not show the video but some code instead (video URL modified for privacy):

{^widget|(name)YouTubeVideo|(VideoURL)https%3a%2f%2fyoutu.be%2fX4B4AIDM8K4|(Width)425|(Height)355|(AutoPlay)True|(widget_displayname)YouTube+video^}

Recent Answers


Brenden Kehren answered on May 24, 2019 20:06

If you're displaying this in a transformation of say a repeater, you will need to add this in your transformation to properly process the widget data:

<%# CMS.MacroEngine.MacroResolver.Resolve(Eval<string>("ColumnName")) %>

0 votesVote for this answer Mark as a Correct answer

Shivinder Singh answered on May 24, 2019 22:25

This is for a MVC website. Haven't come across anything called transformation so far. Just content only page.

0 votesVote for this answer Mark as a Correct answer

Eric Dugre answered on May 29, 2019 19:02

Shivinder,

Portal Engine widgets are not supported for MVC sites- you will need to display your YouTube video some other way. You can still store some reference to the video in your rich text field, but you will need to write some code that will generate the necessary output in your MVC application. If you decide to upgrade to Kentico 12, this could be made easier by creating a custom MVC widget: https://docs.kentico.com/k12/developing-websites/page-builder-development/developing-widgets-in-mvc.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.