We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 14883 ☆ A M B ☆
    • 450 Posts
    I realized recently that a page’s "friendly URL" changes when its Container status changes. If I have a parent document aliased ’aaa’ with a child of ’bbb’, the friendly URL for the child document is ’aaa/bbb.html’. But if I have this page on my site for a while, then decide to add new pages beneath ’bbb’, thus making it a container, the friendly URL for ’bbb’ changes from ’aaa/bbb.html’ to ’/aaa/bbb/’.

    I can certainly see this posing a problem for some sites - a long-published page suddenly becomes a container, and the URL changes.

    I think a simple failsafe approach would be this: When a published page changes its container status (by either becoming a container or no longer being a container), Manager notices this and prompts the user, notifying that this will change the friendly URL, and asking if they want to create a permanent alias/symlink/whatever you call it.

    Does this make sense? It feels to me like something that should be a core option.

      • 22303 MODX Staff
      • 10,725 Posts
      Quote from: jrotering at Mar 23, 2010, 11:42 AM

      I realized recently that a page’s "friendly URL" changes when its Container status changes. If I have a parent document aliased ’aaa’ with a child of ’bbb’, the friendly URL for the child document is ’aaa/bbb.html’. But if I have this page on my site for a while, then decide to add new pages beneath ’bbb’, thus making it a container, the friendly URL for ’bbb’ changes from ’aaa/bbb.html’ to ’/aaa/bbb/’.

      I can certainly see this posing a problem for some sites - a long-published page suddenly becomes a container, and the URL changes.

      I think a simple failsafe approach would be this: When a published page changes its container status (by either becoming a container or no longer being a container), Manager notices this and prompts the user, notifying that this will change the friendly URL, and asking if they want to create a permanent alias/symlink/whatever you call it.

      Does this make sense? It feels to me like something that should be a core option.
      Would be fine with a plugin that did this, but you could also configure the container_suffix to match the HTML content type suffix if you wanted. Will put some thought into it, but can you enter a ticket for this issue so we can discuss/track the details?
        • 3749
        • 24,544 Posts
        Keep in mind that in, Revo, having children and Container status are independent. Container status is determined by the checkbox on the page settings tab (isfolder field). Having children is determined by the hasChildren() method of the resource, which checks for children.

        Unfortunately, legacy snippets may not know about this and assume they are the same thing (which they are in Evo). Some check for actual children, some check the isfolder field.
          Did I help you? Buy me a beer
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/modx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting
          • 6437
          • 157 Posts
          One small comment here - changing URLs for any reason where the content remains the same is nearly always bad for SEO purposes.
            • 32699 ☆ A M B ☆
            • 427 Posts
            I installed Google site-map snippet quite a few betas ago, and Google does not seem to mind the changes much. Running analytics and watching the reports, as well as webmaster tools, and other resources we have -- has shown no issues with switching from a bbb.html to a bbb/.

            The issue appears to come in when the names and/or locations completely change.
              Get your copy of MODX Revolution Building the Web Your Way http://www.sanitypress.com/books/modx-revolution-building-the-web-your-way.html

              Check out my MODX || xPDO resources here: http://www.shawnwilkerson.com
              • 31471
              • 206 Posts
              Quote from: jrotering at Mar 23, 2010, 11:42 AM

              I think a simple failsafe approach would be this: When a published page changes its container status (by either becoming a container or no longer being a container), Manager notices this and prompts the user, notifying that this will change the friendly URL, and asking if they want to create a permanent alias/symlink/whatever you call it.
              My suggestion would be not to make any symlinks for the parent resource on creating a new document!
              A plugin would be nice to ask me if I confirm to change the ’Container’ status of the parent BUT only when I create the first child document of it. On the second, third etc. time it’s completely unnecessary to change that status -- I pretty sure did my decision on it.
                • 14883 ☆ A M B ☆
                • 450 Posts
                Quote from: BobRay at Mar 23, 2010, 04:09 PM

                Keep in mind that in, Revo, having children and Container status are independent. Container status is determined by the checkbox on the page settings tab (isfolder field). Having children is determined by the hasChildren() method of the resource, which checks for children.

                Unfortunately, legacy snippets may not know about this and assume they are the same thing (which they are in Evo). Some check for actual children, some check the isfolder field.

                What is the significance of container status then? I can understand the concept of checking the box and making a resource a container before it has any children... but I can’t grasp a document that has children *not* being considered a container. Please help me understand.

                  • 22303 MODX Staff
                  • 10,725 Posts
                  Quote from: jrotering at Mar 24, 2010, 09:12 AM

                  What is the significance of container status then? I can understand the concept of checking the box and making a resource a container before it has any children... but I can’t grasp a document that has children *not* being considered a container. Please help me understand.
                  It’s simply to provide more flexibility in how you handle requests to folders; for instance, in a traditional web server, accessing foo/ would actually try to load foo/index.html or foo/index.php or similar. By identifying these containers we can then treat them differently as needed, configure different URL extensions exclusively for containers, or, by making a Resource with children not be a container, have it treated like a file with it’s normal extension.

                  The absence/presence of child Resources in the MODx hierarchy simply is not the same as whether a Resource is treated as a container.
                    • 31471
                    • 206 Posts
                    Quote from: OpenGeek at Mar 23, 2010, 11:57 AM

                    Would be fine with a plugin that did this...
                    Quote from: vhollo at Mar 24, 2010, 08:31 AM

                    A plugin would be nice to ask me if I confirm to change the ’Container’ status of the parent BUT only when I create the first child document of it.
                    ... and of course on deleting the last child document from it.
                    (I think it’s important to at least notice the user on changing the properties of a resource other than that is actually being saved/deleted.)

                    Jason, would you comment on this please?
                      • 22303 MODX Staff
                      • 10,725 Posts
                      Quote from: vhollo at Mar 24, 2010, 05:10 PM

                      Quote from: OpenGeek at Mar 23, 2010, 11:57 AM

                      Would be fine with a plugin that did this...
                      Quote from: vhollo at Mar 24, 2010, 08:31 AM

                      A plugin would be nice to ask me if I confirm to change the ’Container’ status of the parent BUT only when I create the first child document of it.
                      ... and of course on deleting the last child document from it.
                      (I think it’s important to at least notice the user on changing the properties of a resource other than that is actually being saved/deleted.)

                      Jason, would you comment on this please?
                      Personally, I don’t want it asking me anything or auto-adjusting the isfolder attribute unless I tell it to specifically. I absolutely separate the concepts of having children and being a container/folder Resource. i.e. when you add or remove files from file system folders, you don’t automatically change the folder to a file. Plus, I like being able to have a Resource with children treated as if it’s not a folder.