title과 favicon 변경

✒️ 2025-05-28 09:42 내용 수정


1. title 변경

title_변경 1.png

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta name="theme-color" content="#000000" />
    <meta
      name="description"
      content="Web site created using create-react-app"
    />
    <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
    <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
	<!-- title을 변경-->
    <title>새로운 타이틀</title>
  </head>
  <body>
    <noscript>You need to enable JavaScript to run this app.</noscript>
    <div id="root"></div>
  </body>
</html>

title_변경 2.png

import { useEffect } from 'react';

function Test() {
	
	useEffect(()=>{ // 타이틀 설정
		document.title = "페이지별 이름";
	}, []);
	
	return(<></>)
}

2. favicon 변경

favicon_변경 1.png

<!-- 변경할 파일 이름으로 설정 -->
<link rel="icon" href="%PUBLIC_URL%/applefavicon.ico">
<!-- public/index.html -->
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta name="theme-color" content="#000000" />
    <meta
      name="description"
      content="Web site created using create-react-app"
    />
    <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
    <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
	<!-- 새 아이콘 추가 -->
	<link rel="icon" href="%PUBLIC_URL%/favicon.ico">
	<!-- title을 변경-->
    <title>새로운 타이틀</title>
  </head>
  <body>
    <noscript>You need to enable JavaScript to run this app.</noscript>
    <div id="root"></div>
  </body>
</html>

favicon_변경 2.png