Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • JoskerVemeulen 68 posts 262 karma points
    Mar 08, 2019 @ 11:57
    JoskerVemeulen
    0

    Global Settings

    I have build a WebSiteConfig node on the same level as the Home node. It uses a document type where i can include headerScripts for instance.

    I want to use a partial view to insert this in my master template. Creating the partial view is no problem, but i can't seem to render the headerScripts on this partial view. Any ideas or examples?

    Using the inser value dropdown gives me:

    @Model.Value("headerScripts")

    But that Isn't working. That just displays nothing(no error).

    Any ideas?

  • Marcio Goularte 388 posts 1360 karma points
    Mar 08, 2019 @ 12:29
    Marcio Goularte
    0

    I believe it would render the property as html

    @Html.Raw(Model.Value("headerScripts"))
    
  • JoskerVemeulen 68 posts 262 karma points
    Mar 08, 2019 @ 13:31
    JoskerVemeulen
    0

    I would think so, but that don't work. If I print out my model on the partialview i get. Umbraco.Web.PublishedModels.Home

  • Frans de Jong 548 posts 1840 karma points MVP 4x c-trib
    Mar 09, 2019 @ 21:25
    Frans de Jong
    0

    Where did you place your partial? The partial will normally receive the model of the current page. So if you place the partial on the master template you'll need to specify your model.

    So something like @Html.Partial("somepartialpath",Umbraco.TypedContentSingleAtXPath("//websiteConfig"))

Please Sign in or register to post replies

Write your reply to:

Draft