Copied to clipboard

Flag this post as spam?

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


  • Saied 349 posts 674 karma points
    Sep 15, 2015 @ 19:11
    Saied
    0

    Should I create a page (node) or can I just create templates for different views on the same page (node)?

    This is something I am struggling with and I am not sure if there is a best practice to it or if it matters? I am not sure what the advantages and/or disadvantages are?

    Let's assume I have a Home document type and a corresponding template and page node, so the root of my website / is linked to the Home template.

    Underneath the Home node, I have a Products node which has a corresponding document type and template.

    Where it gets different is on the Products template I have a form where the user can search for products, once they click search, I see I have a couple options of rendering the page, but unsure what approach is the best practice:

    1 - Create a document type called productsfound with a corresponding template and then in a ProductsController, have an ActionResult method that returns the productsfound.cshtml view, so in this case, I will not be redirected to a productsfound page, I will remain on products, just with a different view.

    2- Create a document type called productsfound with a corresponding template, but in this case create a node under products called products-found and redirect the user to that page? The problem here is passing model to that view? I am not sure of the best way to pass a model to the new page? I can't call return view in this case because that won't redirect?

    I have heard that for every page, you typically have a corresponding template and document type, but I am not 100% sure of that.

    Thanks, Saied

  • Janae Cram 63 posts 439 karma points MVP 8x c-trib
    Sep 15, 2015 @ 19:31
    Janae Cram
    0

    I think this is really a matter of personal preference :)

    I would likely take option 1 because I think it would keep the URL cleaner for users who are browsing the site, and it would likely be less confusing for an admin who is editing content on the site.

    That said... if your "Products Found" page has unique content that an editor would want to modify, giving it a unique DocType & Template then rendering it in the content tree would likely make the most sense and keep it easier for them, and in that case, I would go with option 2.

  • Saied 349 posts 674 karma points
    Sep 15, 2015 @ 19:33
    Saied
    0

    I had the same thoughts, I was thinking that the nodes can get very long. What about the technical limits? Is there anything you can't do if you don't create a page (node)?

    Even if the products found is not unique, I still have to give it a template to render it, right? I just don't have to create a node for it, I can render it under a an existing one? Is this correct?

Please Sign in or register to post replies

Write your reply to:

Draft