I have tried setting below code but i get the below error.
<head>
<link rel="canonical" src="https://www.example.com/" src_type="url"/>
</head>
Please correct the XML data and try again. Element 'head': This element is not expected. Expected is one of ( referenceContainer, container, update, move ). Line: 1
Best Answer
Set homepage canonical url with theme:
OR
Set homepage canonical url with module: