Copied to clipboard

Flag this post as spam?

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


  • Matt Taylor 873 posts 2086 karma points
    Jul 27, 2012 @ 16:31
    Matt Taylor
    0

    Finding the template alias of the current page.

    How do you find the template alias of the current page?

    @Model.template will give you its ID and I thought I could then use Library.NodeById but I'm struggling to get anywhere with it.

    Regards,

    Matt

     

  • Barry Fogarty 493 posts 1129 karma points
    Jul 30, 2012 @ 14:43
    Barry Fogarty
    0

     

    You should be able to use the API to get the template alias using the ID property:

    @using umbraco.cms.businesslogic.template;
    var templateAlias = new Template(Model.template).Text;

     

  • Matt Taylor 873 posts 2086 karma points
    Jul 30, 2012 @ 18:38
    Matt Taylor
    0

    Thank you Barry,

    I'll give that a try.

  • Matt Taylor 873 posts 2086 karma points
    Aug 07, 2012 @ 13:52
    Matt Taylor
    0
    var templateAlias =new Template(Model.template).Alias;

    was what I needed.

    Thanks, Matt

Please Sign in or register to post replies

Write your reply to:

Draft