I am trying to pass a value from a macro into a razor template. But it doesn’t seem to be working any suggestions?
Here is the macro code:
<umbraco:Macro Alias="VideoInline" videoUrl ="[#videoUrl]" videoPosterImage=" <umbraco:Item field=' runat='server' Xslt='umbraco.library:GetMedia({0},false())/umbracoFile'></umbraco:Item>"
runat="server"></umbraco:Macro>
Here’s the razor template:
@using System
@using umbraco.MacroEngines
<video id="my_video_1" class="video-js vjs-default-skin" controls
preload="auto" poster="@Model.getProperty(Parameter.videoPosterImage).Value"
data-setup="{}">
<source src="@Model.getProperty(Parameter.videoUrl).Value" type='video/mp4'>
</video>
When passing parameters into a macro, you should only need to access them with
@Parameter. So in this case it would be@Parameter.videoUrl.Also, don’t forget that you will need to add the parameter to the macro definition in Umbraco itself in the Developers > Macros section.