code: protected static void sortParseableResources(List<CmsResource> parseables) {
  
          Collections.sort(parseables, new Comparator<CmsResource>() {
  
              public int compare(CmsResource a, CmsResource b) {
  
                  return ComparisonChain.start().compare(getRank(a), getRank(b)).compare(
                      a.getRootPath(),
                      b.getRootPath()).result();
              }
  
              int getRank(CmsResource res) {
  
                  if (CmsResourceTypeXmlContainerPage.isContainerPage(res)) {
                      return 0;
                  } else {
                      return 1;
                  }
              }
          });
  
      }
docs: Sorts the parsealble resources before we actually parse the links.<p>
  
  This is needed because we may, for example, have resources A and B such that A has a link to B, and B requires
  the relation corresponding to that link to be present for some functionality (e.g. the page_title macro in gallery name
  mappings), so we need to parse the links for A first to create the relation before B is processed.
  
  @param parseables the list of parseable resources which should be sorted in place