[TASK] Sort inventory based on tree structure

This change respect the website structure when sorting content inventory.

This change also sort external link after all the internal link.