Copied to clipboard

Flag this post as spam?

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


  • Christina Carter 12 posts 93 karma points
    Apr 12, 2016 @ 16:31
    Christina Carter
    0

    Hi there-

    This issue has been posted before but it's been a few years so I'd like to raise it again. I have a site structured like this:

    Home

    • Authors
      • Author Name
    • Categories
      • Category Name
    • Articles
      • Article 1
      • Article 2

    I would like the URLs for the Article pages to be at the root www.mysite.com/article-1 instead of at www.mysite.com/articles/article-1. The reason for setting the article up in a folder is to make things look cleaner on the CMS side for the content folks but the articles themselves should live at the root of the site.

    Is there a way to do this without having to set the umbracoUrlName on each article? Ideally a way to redirect the entire Articles/ folder.

    Thank you in advance.

  • Kevin Jump 2310 posts 14695 karma points MVP 7x c-trib
    Apr 12, 2016 @ 17:28
    Kevin Jump
    0

    Hi,

    it's not a solution in every situation (for example for multi site installs) but I think you could just move the articles node to the same level as home.

    If articles has no template and is below home in the tree then it won't i think get rendered at the root (home will) but the URLs for articles below will be /article-1 /article-2 etc...

  • Christina Carter 12 posts 93 karma points
    Apr 12, 2016 @ 18:16
    Christina Carter
    0

    Kevin, thanks for your reply. I think moving that node to the root will complicate all of my queries on the other nodes. For example, there is a Category template that pull all of the articles that are associated with the category. I had a hard time in the past querying from inside one root node, out to the root, and into another node in the past.

  • Kevin Jump 2310 posts 14695 karma points MVP 7x c-trib
    Apr 12, 2016 @ 18:30
    Kevin Jump
    0

    yeah, it's not always the way to do it.

    although

     var articleRoots = Umbraco.TypedContentAtXPath("//articleFolder");
    

    would get you the root, and you could (if it's not null) call

    var articleRoot = articleRoots.FirstOrDefault(); 
    

    to get the folder where your articles are.

  • Sotiris Filippidis 286 posts 1501 karma points
    May 20, 2016 @ 16:25
    Sotiris Filippidis
    0

    Maybe this plugin will be of help - I published it some days ago, trying to solve this exact problem with "grouping" nodes:

    https://our.umbraco.org/projects/website-utilities/virtualnodes/

    It essentially lets you define document types that will be hidden from the umbraco-generated URLs (the url part that belongs to the node), so that nodes that are of the specified doctypes become "virtual" nodes.

    It's very easy to configure (just install and add a line in your web.config as per instructions). If you do try it, any remarks are welcome. Source code is also available on Github.

    The only drawback is that if you're using the same document type elsewhere, it'll also be hidden, so you'll have to use a document type that is exclusive to what you need to group there.

Please Sign in or register to post replies

Write your reply to:

Draft