--- title: GitHub Pages 블로그 SEO 최적화 가이드 description: 검색엔진 친화적인 정적 블로그 만들기 - robots.txt, sitemap.xml, 메타태그부터 구조화된 데이터까지 date: 2024-11-29 tags: [SEO, GitHub Pages, 블로그 최적화, 검색엔진 최적화, sitemap, robots.txt, 메타태그] ---
GitHub Pages 블로그 SEO 최적화 가이드
GitHub Pages로 만든 정적 블로그가 검색엔진에서 잘 노출되지 않는 문제를 해결하는 실전 SEO 최적화 방법.SEO 최적화 전후 비교
Before (기본 HTML)
- SEO 점수: 30-40점
- 검색엔진 발견 어려움
- 소셜 공유 시 엉망인 미리보기
- 구조화된 정보 부족
After (완전 최적화)
- SEO 점수: 80-90점
- 검색엔진 친화적 구조
- 완벽한 소셜 미디어 지원
- 리치 스니펫 대응
1단계: 기본 SEO 인프라 구축
robots.txt 생성
검색엔진 크롤러에게 사이트 구조를 알려주는 필수 파일.
User-agent: *
Allow: /
# 사이트맵 위치
Sitemap: https://yoursite.github.io/sitemap.xml
# 불필요한 파일들 차단
Disallow: /.git/
Disallow: /node_modules/
Disallow: /*.js$
Disallow: /*.css$
동적 사이트맵 생성기
게시물이 추가될 때마다 사이트맵을 업데이트하는 스크립트.
// generate-sitemap.js
const fs = require('fs');
async function generateSitemap() {
const baseUrl = 'https://yoursite.github.io';
const posts = JSON.parse(fs.readFileSync('./posts/index.json', 'utf8'));
let sitemap = `<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<!-- 메인 페이지 -->
<url>
<loc>${baseUrl}/</loc>
<lastmod>${new Date().toISOString().split('T')[0]}</lastmod>
<changefreq>weekly</changefreq>
<priority>1.0</priority>
</url>
`;
// 각 게시물별 URL 추가
for (const post of posts.posts) {
const postContent = fs.readFileSync(post.path, 'utf8');
const frontMatterMatch = postContent.match(/^---([\s\S]*?)---/);
let lastmod = new Date().toISOString().split('T')[0];
if (frontMatterMatch) {
const frontMatter = frontMatterMatch[1];
const dateMatch = frontMatter.match(/date:\s*(.+)/);
if (dateMatch) {
const date = dateMatch[1].trim();
lastmod = date.includes('-') ? date : `${date}-01-01`;
}
}
sitemap += ` <url>
<loc>${baseUrl}/#${post.id}</loc>
<lastmod>${lastmod}</lastmod>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>
`;
}
sitemap += `</urlset>`;
fs.writeFileSync('./sitemap.xml', sitemap);
console.log('사이트맵 생성 완료');
}
generateSitemap().catch(console.error);
사용법:
node generate-sitemap.js
2단계: 메타 태그 최적화
HTML head 섹션 강화
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- SEO 메타 태그 -->
<title>블로그 제목 - 주요 키워드 포함</title>
<meta name="description" content="검색 결과에 나타날 설명문 (150자 이내)">
<meta name="keywords" content="주요키워드, 관련키워드, 태그들">
<meta name="author" content="작성자명">
<!-- Open Graph (페이스북, 카카오톡 등) -->
<meta property="og:title" content="블로그 제목">
<meta property="og:description" content="블로그 설명">
<meta property="og:type" content="website">
<meta property="og:url" content="https://yoursite.github.io/">
<meta property="og:site_name" content="사이트명">
<meta property="og:locale" content="ko_KR">
<!-- Twitter Card -->
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="블로그 제목">
<meta name="twitter:description" content="블로그 설명">
<!-- 검색엔진 최적화 -->
<meta name="robots" content="index, follow">
<link rel="canonical" href="https://yoursite.github.io/">
</head>
동적 메타데이터 업데이트
게시물을 로드할 때마다 메타데이터를 업데이트하는 JavaScript 함수:
// SEO 메타데이터 동적 업데이트
function updateSEOMetadata(post, postId) {
// 페이지 제목 업데이트
document.title = `${post.title} - 블로그명`;
// 메타 description 업데이트
const description = post.description ||
post.content.replace(/<[^>]*>/g, '').substring(0, 150) + '...';
updateMetaTag('name', 'description', description);
updateMetaTag('property', 'og:title', post.title);
updateMetaTag('property', 'og:description', description);
updateMetaTag('property', 'og:url', `https://yoursite.github.io/#${postId}`);
// Canonical URL 업데이트
updateLinkTag('canonical', `https://yoursite.github.io/#${postId}`);
}
// 유틸리티 함수들
function updateMetaTag(attr, name, content) {
let meta = document.querySelector(`meta[${attr}="${name}"]`);
if (meta) {
meta.setAttribute('content', content);
} else {
meta = document.createElement('meta');
meta.setAttribute(attr, name);
meta.setAttribute('content', content);
document.head.appendChild(meta);
}
}
function updateLinkTag(rel, href) {
let link = document.querySelector(`link[rel="${rel}"]`);
if (link) {
link.setAttribute('href', href);
} else {
link = document.createElement('link');
link.setAttribute('rel', rel);
link.setAttribute('href', href);
document.head.appendChild(link);
}
}
3단계: 구조화된 데이터 (JSON-LD)
구글이 이해하기 쉬운 형태로 블로그 정보를 제공.
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Blog",
"name": "블로그명",
"description": "블로그 설명",
"url": "https://yoursite.github.io/",
"author": {
"@type": "Person",
"name": "작성자명"
},
"publisher": {
"@type": "Person",
"name": "작성자명"
},
"inLanguage": "ko-KR",
"blogPost": [
{
"@type": "BlogPosting",
"headline": "게시물 제목",
"url": "https://yoursite.github.io/#post-id",
"datePublished": "2024-11-29",
"author": {
"@type": "Person",
"name": "작성자명"
}
}
]
}
</script>
4단계: SEO 모니터링 설정
Google Search Console 등록
- 속성 추가 → URL 접두사 방식 선택
- GitHub Pages 도메인 입력
- HTML 파일 업로드로 소유권 확인
- 사이트맵 제출:
https://yoursite.github.io/sitemap.xml
핵심 모니터링 지표
- 검색 노출수: 게시물이 검색 결과에 나타난 횟수
- 클릭수: 실제 방문자 수
- 평균 게재순위: 검색 결과에서의 평균 순위
- CTR (클릭률): 노출 대비 클릭 비율
5단계: 컨텐츠 SEO 최적화
게시물 Front Matter 최적화
---
title: 구체적이고 검색 친화적인 제목
description: 게시물 요약 설명 (150자 이내)
date: 2024-11-29
tags: [주요키워드, 관련키워드, 세부키워드]
category: Web
---
SEO 친화적 글쓰기 팁
- 제목 최적화
- 메타 description 작성
- 헤딩 구조화
# H1: 메인 제목 (페이지당 1개)
## H2: 주요 섹션
### H3: 세부 항목
- 내부 링크 활용
6단계: 성능 최적화
이미지 SEO
<!-- SEO 친화적 이미지 태그 -->
<img src="image.jpg"
alt="구체적인 이미지 설명"
title="이미지 제목"
loading="lazy"
width="800"
height="600">
Core Web Vitals 최적화
- LCP (Largest Contentful Paint): 2.5초 이내
- FID (First Input Delay): 100ms 이내
- CLS (Cumulative Layout Shift): 0.1 이내
실전 SEO 체크리스트
기술적 SEO
- [ ] robots.txt 설정
- [ ] sitemap.xml 생성
- [ ] 메타 태그 완성
- [ ] 구조화된 데이터 추가
- [ ] HTTPS 설정 (GitHub Pages 기본 제공)
컨텐츠 SEO
- [ ] 키워드 리서치 완료
- [ ] 제목 최적화
- [ ] 메타 description 작성
- [ ] 헤딩 구조화
- [ ] 내부 링크 추가
사용자 경험
- [ ] 모바일 친화적 디자인
- [ ] 빠른 로딩 속도
- [ ] 명확한 네비게이션
- [ ] 읽기 쉬운 폰트와 색상
SEO 배포 스크립트
새 게시물 추가 시 SEO 작업을 처리하는 배포 스크립트:
#!/bin/bash
# deploy.sh
echo "SEO 최적화 배포 시작..."
# 사이트맵 재생성
echo "사이트맵 업데이트..."
node generate-sitemap.js
# Git 커밋
echo "변경사항 커밋..."
git add .
git commit -m "새 게시물 추가 및 SEO 최적화"
git push
echo "배포 완료. Google Search Console에서 사이트맵 재제출 권장."
SEO 성과 측정
예상 개선 효과 (3개월 기준)
- 검색 트래픽: 300-500% 증가
- 검색 노출수: 10배 이상 증가
- 평균 게재순위: 50위 → 10위 내
- 브랜드 인지도: 크게 향상
핵심 성공 지표
- 유기적 검색 트래픽 증가
- 검색 결과 상위 노출
- 소셜 미디어 공유 증가
- 백링크 자연 획득
댓글