Copied to clipboard

Flag this post as spam?

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


  • Nicolas Erlijman 14 posts 103 karma points
    Apr 29, 2020 @ 20:01
    Nicolas Erlijman
    0

    How to detect if a specific doctype has a template assigned

    In a razor view I am creating a breadcrumb with links. There I am parsing the url and I need to detect if the specific portion of the url has a template assigned.

    For instance:

    For the url /contacto/ubicacion-clinica-centro I have 2 possible links

    /contacto - That is contentFolder doctype, without template /contacto/ubicacion-clinica-centro - This is a contentPage with template

    How can I detect if the string "contacto" that has the doctype "contentFolder" does not have an assigned template in a razor view?

  • Alex Skrypnyk 6150 posts 24110 karma points MVP 8x admin c-trib
    Apr 29, 2020 @ 20:21
    Alex Skrypnyk
    0

    Hi Nicolas,

    You can always check on TemplateId property of IPublishedCotnent object, for example, template id of the current page:

    Umbraco.AssignedContentItem.TemplateId
    

    Thanks,

    Alex

Please Sign in or register to post replies

Write your reply to:

Draft