Reputation: 1286
Background: I am working on a JSP web page and the project seems to be pretty fragile. The thing is that there are two tags for generating the canonical tag and I was wondering if this is a mistake of there is a reason behind this. They both are never generated on the same page so there is no competition posible
Depending on the page, the canonical tag can be located at the Position 1 or at the position 2 on the next chunk of code.
<head>
<meta charset="utf-8">
<meta name="viewport" ... >
<link rel="alternate" ... />
<link rel='stylesheet' ... />
<link rel='canonical' ... /><!-- Position 1 -->
<link rel="icon"
<link rel="manifest" ... />
<meta name="custom-property"
<title> My Page </title>
<link rel='canonical' ... /><!-- Position 2 -->
<!-- Blah, blah, blah -->
</head>
Is there any chance that the canonical tag position could affect to the rest of the page?
Upvotes: 0
Views: 226
Reputation: 16281
Not entirely sure why you are implementing multiple canonical links, as your example isn’t detailed enough, but here is the general rule:
head
element. Generally you put elements where you can maintain them best.Where there are two of the same type of element:
Since it is possible that your two canonical elements are in competition, I would be inclined to regard the latter as the canonical canonical element.
Upvotes: 1