Copied to clipboard

Flag this post as spam?

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


  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    Jan 22, 2023 @ 18:32
    Chriztian Steinmeier
    1

    How do I handle Content from a PublishedContentWrapped viewmodel?

    Hi friends 👋

    I've got this (simplified) setup:

    • All document types have a "Meta" composition
    • The MainLayout calls a "MetaTags" partial that takes an <IMeta> model
    • The SearchPage template takes a <SearchViewModel> which is created as a PublishedContentWrapped from a SearchPageController.

    My problem is that when the MetaTags partial runs on the SearchPage, it throws the "Cannot bind SearchViewModel to IMeta" error...

    What's the correct way to solve this?

    /Chriztian

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    Jan 22, 2023 @ 19:09
    Chriztian Steinmeier
    101

    Found something in the docs where this scenario is mentioned. I'm not sure I understand all of the three options for solving it though... but I've made my Meta partial inherit from the generic UmbracoViewPage now, and used the (less than optimal) Value() syntax instead - atleast it works now.

Please Sign in or register to post replies

Write your reply to:

Draft