Allow restricting link sorting

Support passing custom sort keys for links. Useful if links have different
colors, and we want to keep "color streams" continuous across nodes.