Copied to clipboard

Flag this post as spam?

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


  • Olly Fray 11 posts 91 karma points
    Apr 18, 2019 @ 08:54
    Olly Fray
    0

    Umbraco 8 - Where is .DocumentTypeAlias?

    Anyone know what happened to .DocumentTypeAlias property in Umbraco 8?

    I've looked at the source and IPublishedContent doesn't appear to have the property available; has the name changed or has it been moved elsewhere?

    Any ideas on how to get access to it?

    Thanks!

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Apr 18, 2019 @ 09:24
    Dave Woestenborghs
    102

    Hi Olly,

    It has changed a bit in V8

    You will need do this to get the doctype alias

    @Model.ContentType.Alias
    

    Dave

  • Olly Fray 11 posts 91 karma points
    Apr 18, 2019 @ 15:44
    Olly Fray
    0

    Perfect, thank you Dave!

  • Andy Butland 422 posts 2334 karma points MVP 4x hq c-trib
    Apr 18, 2019 @ 09:28
    Andy Butland
    1

    There's a useful extension method on IPublishedContent too if you want to check a content item is of a given document type: @Model.IsDocumentType("myDocType").

    Andy

  • Olly Fray 11 posts 91 karma points
    Apr 18, 2019 @ 15:45
    Olly Fray
    0

    Thank you, very useful!

  • Dave de Moel 122 posts 574 karma points c-trib
    Apr 18, 2019 @ 09:30
    Dave de Moel
    0

    And if you have access to the PublishedContentModels you can use f.e. MediaBlock.ModelTypeAlias

Please Sign in or register to post replies

Write your reply to:

Draft