Updated to use better route information when determining template includes