*✅ Canonical URL이란? *표준
중복된 컨텐츠가 여러 URL에서 제공되는 경우, 검색 엔진에게 선호하는 정규 URL을 지정하는 방법.
<head>
<link rel="canonical" href="정규_URL">
</head>
✅ Why?
✅ When?
모바일 기기와 데스크톱 화면 크기, 성능, UI 요구사항에 따라 별도의 URL로 페이지를 제공할 때 https://example.com (desktop) 와 https://m.example.com (mobile) 모바일 페이지에 canonical URL을 추가할 수 있다.
추가 설정을 통해 모바일 페이지임을 검색엔진에게 알릴 수 있다.
//Mobile Page: canonical Tag
<head>
<link rel="canonical" href="<https://example.com>" />
</head>
//[Optional] Desktop Page, mobile임을 알림
<head>
<link
rel="alternate"
media="only screen and (max-width: 640px)"
href="<https://m.example.com>"
/>
</head>
✅ NEXT.js 에서 사용하기
import Head from 'next/head/';
export default function ProductPage() {
return (
<>
<Head>
<link rel="canonical" href="<https://example.com/product/shirt>" />
</Head>
<h1>Content Page</h1>
</>
);
}