Search

기본 제공 페이지의 이름 변경하기

태그
일반
다중 선택
1 more property
장바구니, 리뷰, 문의, 마이페이지 등 기본으로 제공되는 페이지의 이름을 아래 코드를 활용해 원하는 문구로 변경할 수 있어요.
아래의 HTML 소스코드를 테마 설정의 커스텀 코드 <body> 코드에 입력하고, 페이지 이름을 변경해 주세요.
<script> const textMap = { "리뷰": "리뷰 커스텀 제목", "문의": "문의 커스텀 제목", "장바구니": "장바구니 커스텀 제목", "위시리스트": "위시리스트 커스텀 제목", "마이페이지": "마이페이지 커스텀 제목" }; const selectors = 'h1, h2, h3, h4, h5, h6, nav a'; function updateText(element) { const currentText = element.textContent.trim(); if (textMap[currentText]) { element.textContent = textMap[currentText]; } } document.querySelectorAll(selectors).forEach(updateText); const observer = new MutationObserver((mutations) => { mutations.forEach(mutation => { mutation.addedNodes.forEach(node => { if (node.nodeType === 1) { if (node.matches(selectors)) { updateText(node); } node.querySelectorAll(selectors).forEach(updateText); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); </script>
JavaScript
복사
위 코드를 활용하면 리뷰, 문의, 장바구니, 위시리스트 외의 페이지의 이름(h1~h6, nav a)을 원하는 문구로 변경할 수 있어요.
예시) 게시판 페이지
“게시판 이름”:”게시판 이름 커스텀 제목”,
JavaScript
복사
HTML 블록 안내서로 돌아가기