사적인 블로그
[SEO] 검색엔진 잘 잡히려면 robots, sitemap 본문
검색엔진이 나의 소중한 사이트를 그냥 잡아주는게 아니라,
날 잡아주십셔 손을 휘적휘적 저어야지 잡아준다.
구글, 네이버 등등에 원활하게 검색되기 위해 또는 검색되지 않기 위해 해야 하는 작업들
1. / 하위에 robots.txt , sitemap.xml 파일을 생성한다
robots.txt는 필수고 sitemap.xml은 하면 더 좋은 느낌쓰
robots.txt 예시
sitemap: https://www.oursite.com/sitemap.xml
User-agent: *
allow: /
disallow: /index
disallow: /Index
disallow: /contents/*
disallow: /service/*
robots.txt는 검색엔진 로봇들이 www의 광활한 바다를 돌아다닐때
우리 사이트에 안착할 수 있는 착륙페이지다.
직관적으로, allow는 검색 허용하는 하위 주소들이고
disallow는 검색허용하지 않는 부분들이다. 개인정보 보호때문이 될수도있고, 컨텐츠를 굳이 노출시키지 않아도 될때에는 disallow로 막아놓기!
sitemap 파일 주소도 살포시 적는다.
sitemap.xml 예시
<?xml version="1.0" encoding="UTF-8"?>
<urlset // 사이트맵의 루트 태그. 모든 URL 정보를 포함
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
<url> // 각 페이지 정보
<loc>https://www.oursite.com/index</loc> // 페이지 url
<lastmod>2024-12-02T06:47:16+00:00</lastmod> // 해당 페이지의 last 수정 날짜/시간 _ 이걸보고 엔진이 업데이트 갈말 결정함
<priority>1.00</priority> // 페이지 우선순위 (0.0(낮음) ~ 1.0(높음))
</url>
<url>
<loc>https://www.oursite.com/ko/contents/news</loc>
<lastmod>2024-12-02T06:47:16+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>https://www.oursite.com/ko/contents/notice</loc>
<lastmod>2024-12-02T06:47:16+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>https://www.oursite.com/contents/note</loc>
<lastmod>2024-12-02T06:47:16+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>https://www.oursite.com/contents/introduce</loc>
<lastmod>2024-12-02T06:47:16+00:00</lastmod>
<priority>0.80</priority>
</url>
</urlset>
site.xml은 웹사이트의 구조와 정보를 알려주기위해 리스트업하는 파일이다
검색노출을 희망하는 페이지들을 검색엔진이 보다 더 잘 크롤링하고 인덱싱하도록 돕는 페이지!
그니까 사이트 지도같은거라고나 할까
사이트맵 파일은 보통 robots.txt 파일에서 경로를 명시하거나,
검색엔진의 웹마스터 도구(Google Search Console, Bing Webmaster 등)에 제출한답니다
여기서 상식이라면
.json은 검색될 이유가...? 없겟져? 🤷♂️
'TIL' 카테고리의 다른 글
[JS] HTML <a>태그에서 JS로 alert 띄우기 (0) | 2024.12.18 |
---|---|
[OS/Window] 포트 찾고 프로세서 kill 하는 CMD 명령어 (0) | 2024.12.13 |
[Java] String = 파라미터, null 인가 "" 인가 (0) | 2024.12.13 |
[보안] reCAPTCHA site key(client key), secret key(server key) (1) | 2024.12.13 |
[JPA] CRUD 와 scaffold (0) | 2024.12.05 |