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 3325 posts 11170 karma points MVP 5x admin c-trib
    Apr 18, 2019 @ 09:24
    Dave Woestenborghs
    101

    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 373 posts 2057 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 121 posts 553 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

  • 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