Copied to clipboard

Flag this post as spam?

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


  • Jon Bone 7 posts 37 karma points
    Jan 06, 2014 @ 12:08
    Jon Bone
    0

    @Model.NodeTypeAlias - How is this set

    Hi,

    I am very new to Umbraco and have inherited a site that my client would like extending. On the whole I've found Umbraco very easy to get to grips with and extend as I desire, however one thing has me stumped.

    The agency that designed the site has set a class on the body element to @Model.NodeTypeAlias and I cannot figure out how this is set.

    When looking at my local and staging site the class attribute is as expected, but on my clients production server this class is set incorrectly, looking through the setup for the Document Types and Templates all settings appear to match between installations.

    The site is using umbraco 4.7.1.1.

    I'd be grateful to anyone who can help me out with this question.

    Cheers, Jon.

  • Jeavon Leopold 3074 posts 13631 karma points MVP 11x admin c-trib
    Jan 06, 2014 @ 12:31
    Jeavon Leopold
    0

    Hi Jon,

    Welcome to Our!

    The value will be alias of the document type being rendered. Documentation here

    Jeavon

  • Jon Bone 7 posts 37 karma points
    Jan 06, 2014 @ 12:54
    Jon Bone
    0

    Hi Jeavon, thanks for the welcome and the quick reply.

    Just for my own sanity, I've deleted the content item and document type that I'm working with and recreated them.

    The document type has an alias of CandidatePortal, yet when I open the page and view the source the class attribute of the body element is Home.

    I'm sure this is something really obvious that I'm missing as when I look at my test site the class attribute is CandidatePortal.

  • Jeavon Leopold 3074 posts 13631 karma points MVP 11x admin c-trib
    Jan 06, 2014 @ 14:01
    Jeavon Leopold
    0

    Strange, are you sure the page you are viewing on the front end website is using your new document type?

  • Jon Bone 7 posts 37 karma points
    Jan 06, 2014 @ 14:21
    Jon Bone
    0

    I'm fairly sure, if I change the template text then the page shown on the website changes. I guess that would confirm that the page is linked to the correct template and also that the document types are correct or the structure wouldn't work.

    I've put some screenshots below of the bits I think are relevant, would be great if you could let me know if anything looks wrong.

    Master Template: http://imageshack.com/a/img834/9679/ynvz.png

    Page Template: http://imageshack.com/a/img513/3139/xqlj.png

    Document Type: http://imageshack.com/a/img834/9679/ynvz.png

    Page Settings: https://imageshack.com/i/gou3uip

    I appreciate you taking the time to help me out.

  • Jeavon Leopold 3074 posts 13631 karma points MVP 11x admin c-trib
    Jan 06, 2014 @ 15:21
    Jeavon Leopold
    0

    Ok, and when you view /candidate-portal.aspx @Model.NodeTypeAlias renders "Home" not "CandidatePortal"?

  • Jon Bone 7 posts 37 karma points
    Jan 06, 2014 @ 15:30
    Jon Bone
    0

    badaboom.. thank you, thats just pointed out the obvious..

    I was viewing /candidateportal.aspx (without the hyphon)

    That in turn gives a new question though, how was umbraco rendering the page without the hyphon ? And can I have both URL's without creating two pages ?

  • Jeavon Leopold 3074 posts 13631 karma points MVP 11x admin c-trib
    Jan 06, 2014 @ 15:32
    Jeavon Leopold
    0

    Awesome! Maybe you have a 404 page setup to be your homepage, try something random?

  • Jon Bone 7 posts 37 karma points
    Jan 06, 2014 @ 16:11
    Jon Bone
    0

    It's not a 404 handler. An unknown file extension gives a blank page and a genuinly invalid page (wibble.aspx) gives a custom 404.

    Both /candidateportal.aspx and /candidate-portal.aspx render the same page contents, with the exception that the former has the incorrect NodeTypeAlias.

    My issue is that I've told the client that page name that doesn't work and they have used it in mailshots already. I've added a hacky bit of jQuery to hide the issue for now but I'd like to understand why Umbraco is rendering both Urls.

  • Jeavon Leopold 3074 posts 13631 karma points MVP 11x admin c-trib
    Jan 06, 2014 @ 16:33
    Jeavon Leopold
    0

    Is it possible that your homepage has a "umbracoUrlAlias" property which contains this path? Also worth checking for "umbracoUrlName".

  • Jon Bone 7 posts 37 karma points
    Jan 06, 2014 @ 16:55
    Jon Bone
    0

    No. I would have no idea on how to set either one of those properties.

  • Jeavon Leopold 3074 posts 13631 karma points MVP 11x admin c-trib
    Jan 06, 2014 @ 17:05
    Jeavon Leopold
    100

    Maybe worth checking all your properties on the document type and any it inherits from to see if either exist?

    Another option could possibly be a rewrite rule, check web.config and /config/UrlRewriting.config to see if there is any mention of candidateportal without the hyphens.

  • Jon Bone 7 posts 37 karma points
    Jan 06, 2014 @ 17:47
    Jon Bone
    0

    Well, I've removed the space from the page name in the content tab and now it only renders for candidateportal.aspx and not candidate-portal.aspx. The html being generated is now correct, so I'm going to tell the client about the correct page name and have a look at the url rewriting to see if i can set a rewrite to redirect any requests for candidate-portal.aspx to candidateportal.aspx.

    Thanks for all your help. I'll spend a bit more time when I get a chance reading up on Umbraco and the architecture so hopefully I'll understand a bit more about document types and how it affects the page names and rendering.

  • Jeavon Leopold 3074 posts 13631 karma points MVP 11x admin c-trib
    Jan 06, 2014 @ 18:03
    Jeavon Leopold
    0

    You're welcome!

Please Sign in or register to post replies

Write your reply to:

Draft