Copied to clipboard

Flag this post as spam?

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


  • Heather 13 posts 125 karma points
    May 14, 2020 @ 18:43
    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 6182 posts 24284 karma points MVP 8x admin c-trib
    May 14, 2020 @ 20:09
    Alex Skrypnyk
    101

    Hi Heather

    Try this code:

    @if(Model is IOpenGraph){
        @Html.Partial("openGraph")
    }
    
  • Heather 13 posts 125 karma points
    May 18, 2020 @ 16:21
    Heather
    1

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

  • Alex Skrypnyk 6182 posts 24284 karma points MVP 8x admin c-trib
    May 18, 2020 @ 16:25
    Alex Skrypnyk
    0

    You are always welcome, Heather!

  • Dmitriy 168 posts 588 karma points
    May 15, 2020 @ 10:14
    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?

  • Deryn Johnstone 5 posts 75 karma points
    Sep 10, 2020 @ 04:15
    Deryn Johnstone
    0

    Hi guys,

    I am also struggling with this error.

    The type or namespace name 'IOpenGraph' could not be found (are you missing a using directive or an assembly reference

    After adding this code to my Partial View openGraph.cshtml following the tutorial.

    @inherits Umbraco.Web.Mvc.UmbracoViewPage<IOpenGraph>
    
  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies