I had the same problem where I wanted to be able to choose whether a canonical attribute would be added to my article links.
The following is modified from @bart 's answer to a similar question from a different forum post - Conditional canonical link in head custom code - #6 by jvictormendes
I created a switch on our blog collection for syndicated content. When you turn it on, then a link is created in the head with canonical attribute. It takes the potential human error out of creating a link every time we have a syndicated blog article.