This tutorial is about Magento 2 add canonical link .i.e how to add a canonical link to a page through it’s layout file?. I assume your question is,is it possible?
So the answer is, Yes.It is possible. And in this tutorial i will try to explain it briefly and in a simple way.
Lets suppose you have a custom page and you want to add a canonical link to it in the layout file. Well,in magento 2 we can specify meta data in the head node.Similarly it is possible to add the canonical link in the layout as well.
It is quite doable and in a very easy way.
Just put the below lines of code in your own code.
<link rel="canonical" src="pageurl" src_type="url"/>
Furthermore change the ‘pageurl’ as per your requirements. And place it in custom layout section in admin , if you want the functionality using admin custom layout section.
That’s it from this tutorial. I hope it serves the purpose.
Since these are learning tutorials,please feel free to drop any suggestions or queries in comments section. That will definitely be highly appreciated.