Create an MVC component for the UI
Describes how to create a component in the Optimizely Content Management System (CMS) user interface.
The Optimizely Content Management System (CMS) extension of the IFrameComponent
has the following additional parameters:
UrlFromUtil
– Optional. The URL to the source is relative to theUtils
folder. Used instead ofUrl
property.UrlFromUi
– Optional. The URL to the source is relative to theUI
folder. Used instead ofUrl
property.
- Add a
Controller
and annotate it with anIframeComponent
attribute.[IFrameComponent(Url = "/helloworld", Title = "Hello World Component", Categories = "content")] public class HelloWorldController: Controller { public ActionResult Index() { return View(); } }
- Add a
Index.cshtml
view to theViews/HelloWorld
directory:@{ Layout = null; } <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width" /> <title>HelloWorld</title> </head> <body> <div> <div>Hello World</div> </div> </body> </html>
Updated 6 months ago