1 Reply Latest reply on Jan 8, 2014 4:12 PM by breakpoint

    What should nodes in content repository be named?

    breakpoint

      I have been trying to understand what actually goes into a node name but I am struggling with grasping the concept.

       

      Let say you have a question&answer system. I want to save each question in the content repository. What would the node name be? Should the questions be giving incrementing ids or should I name them after the actual question? If I do name them after the question I will run into naming collisions since I can have multiple questions with "what does this sign mean" (example below).

       

      I haven't grasped the concept of naming nodes, could someone teach me this?

       

      /questions/1

      /questions/2

      /questions/3

       

      /questions/what-is-a-car

      /questions/what-does-this-sign-mean

       

       

      Thank you.

        • 1. Re: What should nodes in content repository be named?
          breakpoint

          I was lucky to chat with rhaush on IRC and I asked him the same question I did here basically.

           

          What I was struggling with was how to name nodes. I used the example of storing questions in the content repository. I didn't know what to name the nodes. I thought using arbitrary ids was bad (but I don't know where I got that from). It isn't though. Not all nodes have a natural name that you could use. Ids are fine then. If I used the title as a node name I would run into naming collision. Two or more questions could have the same title. You could do something to help the situation by organising the nodes like this:

           

          /questions/{year}/{month}/{date}/{title}

           

          But this still mean that two questions added on the same day can collide. Instead I do this to prevent collision:

           

          /questions/{year}/{month}/{date}/{id}


          So to answer my own question: using ids are fine when a natural name is not available to use. You also want the repository structure of nodes to be hierarchical, so deeper rather than flat&wide, that is why the questions are organized under the date it is added (submitted).