Sitemap 사이트맵 이란?

출판일자 

읽는 데 걸리는 시간 1분


사이트맵..?

페이지, 비디오, 파일들의 아웃라인(개괄) 을 담은 XML 파일. SEO crawl bot 에 좋다고 합니다.

구글의 조언 🔗

TL;DR;

봇에게 어느 부분, 파일이 중요한지 명시.

추가 전달 가능한 메타데이터

  • - video: 재생시간, age-appropriate 레이팅.
  • - image: 포함된 위치.
  • - news: 기사 제목, 게시 날짜.

언제 필요?

  • - 큰 사이트: 너무 크면 구글 봇이 구조파악을 정확히 할 수 없을 가능성이 있음.
  • - 내부링크가 많음: 제공함으로서 구글 봇이 따라가며 파악 가능.
  • - 미디어 파일, 뉴스 페이지가 별로 없음.

Application Of Sitemap in the context of real usage!

블로그 제작에 사용된 Astro 프레임워크에서도 plugin 으로 (@astrojs/sitemap) 🔗

을 제공해준다!

설치

# Using NPM
npx astro add sitemap

# Using Yarn
yarn astro add sitemap

# Using PNPM
pnpm astro add sitemap

세팅

import { defineConfig } from 'astro/config';
import sitemap from '@astrojs/sitemap';
export default defineConfig({
  // ...
  site: 'https://stargazers.club',
  integrations: [sitemap()],
})

이후 astro build -> dist/sitemap-index.html, dist/sitemap-0.xml 발견! 이후 <head> 에 메타데이터를 연결.

<head>
<link rel="sitemap" href="/sitemap-index.xml">
</head>

public/robots.txt

User-agent: *
Allow: /
Sitemap: https://<YOUR SITE>/sitemap-index.xml