Copied to clipboard

Flag this post as spam?

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


  • Heather 2 posts 73 karma points
    1 week ago
    Heather
    0

    Open Graph following Umbraco Tutorial

    Hello, I am struggling with this tutorial. (https://our.umbraco.com/Documentation/Tutorials/Starter-kit/Lessons/3-Add-Open-Graph/step-1) On step 3 it states to add the following code.

    @if(Model.Content is IOpenGraph){
        @Html.Partial("openGraph")
    }
    

    I have added this to my master.cshtml and created to partial. For some reason I get the following error.

    IPublishedContent' does not contain a definition for 'Content' 
    

    Can anyone tell me what I am doing wrong?

  • Alex Skrypnyk 5730 posts 21691 karma points MVP 3x admin c-trib
    1 week ago
    Alex Skrypnyk
    2

    Hi Heather

    Try this code:

    @if(Model is IOpenGraph){
        @Html.Partial("openGraph")
    }
    
  • Heather 2 posts 73 karma points
    1 week ago
    Heather
    1

    Thanks Alex, this code got me working again. :)

  • Alex Skrypnyk 5730 posts 21691 karma points MVP 3x admin c-trib
    1 week ago
    Alex Skrypnyk
    0

    You are always welcome, Heather!

  • Dmitriy 168 posts 585 karma points
    1 week ago
    Dmitriy
    1
    IPublishedContent' does not contain a definition for 'Content' 
    

    Seems it is an answer :)

    Your model has no Content property.

    Which view model do you use? What is in your @inherits at start of the razor view?

Please Sign in or register to post replies

Write your reply to:

Draft