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 5 posts 74 karma points
    27 days ago
    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 5730 posts 21691 karma points MVP 3x admin c-trib
    27 days ago
    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