Copied to clipboard

Flag this post as spam?

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


  • Craig100 1136 posts 2523 karma points c-trib
    Aug 12, 2016 @ 10:59
    Craig100
    0

    Using own master with new fields added to Articulate docTypes

    Hi,

    Umb 7.4.3 (upgraded from 6.1.5)

    Adding Articulate blog to existing upgraded site. Using /Views/master.cshtml for the blog which expects some fields to exist. Added these fields to the Articulate docType. Get YSOD complaining "Object reference not set to an instance of an object." at Line 9: var pageTitle = string.IsNullOrWhiteSpace(Model.GetPropertyValue("metaTitle").ToString())

    /Views/master.cshtml looks like this:-

    @inherits UmbracoViewPage    
    @{
        Layout = null;   
    
        var pageTitle = string.IsNullOrWhiteSpace(Model.GetPropertyValue("metaTitle").ToString())
            ? Model.Name
            : Model.GetPropertyValue("metaTitle");
    }
    <!DOCTYPE html>
    <html lang="en">
    <head>.......etc.....
    

    Is it possible to get this working?

    If it makes a difference, I have ModelsBuilder switched off in web.config as I wasted a whole day trying to get it working and failed (miserably).

    Thanks

  • MarcC 49 posts 356 karma points
    Aug 19, 2016 @ 15:24
    MarcC
    0

    Hey,

    Could you maybe use HasValue and check?

       var pageTitle = !Model.HasProperty("metaTitle") ? Model.Name : Model.GetPropertyValue("metaTitle");
    

    Good luck

  • Craig100 1136 posts 2523 karma points c-trib
    Aug 19, 2016 @ 16:51
    Craig100
    0

    Thanks MarcC but that didn't work. It just errors on the line where @pageTitle is called. I have the impression it's a deeper issue than it initially appears as the pageTitle code works fine for all pages other than Blog and it's child pages.

  • Craig100 1136 posts 2523 karma points c-trib
    Aug 24, 2016 @ 15:42
    Craig100
    0

    Continuing my quest for answers at https://github.com/Shazwazza/Articulate/issues/158

    Thanks.

  • Craig100 1136 posts 2523 karma points c-trib
    Aug 25, 2016 @ 16:57
    Craig100
    0

    The answer, dear friends, lies here: https://www.marceldigital.com/blog/2015/09/how-to-setup-an-articulate-blog-package-to-an-existing-umbraco-layout

    It slightly outdated now but it got me working :)

    I just had to remove this line from List.cshtml:- Html.RequiresCss("http://cdnjs.cloudflare.com/ajax/libs/octicons/2.1.2/octicons.css");

    Hope this helps some other poor sap :)

Please Sign in or register to post replies

Write your reply to:

Draft