document canonical name and move vars down to usage

Closes #20719.
Remove unused guard in canonical_name

Closes #20718.