IndexNow๋ก ์น์ฌ์ดํธ ์ฝํ ์ธ ๋ณ๊ฒฝ ์ฌํญ ์ฆ์ ๋ฐ์ํ๋ ๋ฐฉ๋ฒ
๋น ์น๋ง์คํฐ ์น์ฌ์ดํธ์์ URL์ ๊ฒ์ ์์ง์ ์ ์ํ๊ฒ ์ ์ถํ ์ ์๋ IndexNow ์ฌ์ฉ ๋ฐฉ๋ฒ ์ ๋๋ค. ์ด๋ฅผ ํตํด ์น์ฌ์ดํธ์ ์ฝํ ์ธ ๋ณ๊ฒฝ ์ฌํญ์ ์ฆ์ ๋ฐ์ํ์ฌ ๊ฒ์ ๊ฒฐ๊ณผ์ ๋น ๋ฅด๊ฒ ๋ ธ์ถ๋ ์ ์์ต๋๋ค.
ํนํ, API ํค๋ฅผ ํ์ฉํด ์๋์ผ๋ก URL์ ์ ์ถํ ์ ์์ด SEO ์ต์ ํ์ ํฐ ๋์์ด ๋ฉ๋๋ค. ๋ํ, RSS ํผ๋๋ฅผ ํตํด ์ต์ ์ฝํ ์ธ ๋ฅผ ์๋์ผ๋ก ์๋ฆด ์ ์์ด ๊ด๋ฆฌ ํจ์จ์ฑ์ด ๋์์ง๋๋ค.
IndexNow ์ธ๋ฑ์ค ๋์ฐ ์ฌ์ฉ ๋ฐฉ๋ฒ
Bing Webmaster Tools ๊ฐ์
- Bing Webmaster Tools ์น์ฌ์ดํธ์ ๋ฐฉ๋ฌธํฉ๋๋ค.
- Microsoft ๊ณ์ ์ผ๋ก ๋ก๊ทธ์ธํฉ๋๋ค. ๊ณ์ ์ด ์๋ค๋ฉด ์๋ก ์์ฑํด์ผ ํฉ๋๋ค.
์ฌ์ดํธ ์ถ๊ฐ
- ๋ก๊ทธ์ธ ํ ๋์๋ณด๋์์ "์ฌ์ดํธ ์ถ๊ฐ" ๋ฅผ ํด๋ฆญํฉ๋๋ค.
- ์์ ์ ์น์ฌ์ดํธ URL์ ์ ๋ ฅํ๊ณ "์ถ๊ฐ" ๋ฒํผ์ ํด๋ฆญํฉ๋๋ค.
์ฌ์ดํธ ์์ ํ์ธ
- ์ฌ์ดํธ ์์ ๋ฅผ ํ์ธํ๊ธฐ ์ํด HTML ํ์ผ ์ ๋ก๋, ๋ฉํ ํ๊ทธ ์ถ๊ฐ, ๋๋ DNS ๋ ์ฝ๋ ์ถ๊ฐ ์ค ํ๋์ ๋ฐฉ๋ฒ์ ์ ํํฉ๋๋ค.
- ํ์ธ์ด ์๋ฃ๋๋ฉด ๋์๋ณด๋์์ ์ฌ์ดํธ๊ฐ ๋ชฉ๋ก์ ๋ํ๋ฉ๋๋ค.
IndexNow | Bing Webmaster Tools
IndexNow API ํค ๋ฐ๊ธ ๋ฐฉ๋ฒ
1. API ํค ์์ฑ
- ์ฌ์ดํธ ๋์๋ณด๋์์ "IndexNow" ์น์ ์ ์ฐพ์ ํด๋ฆญํฉ๋๋ค.
- ์ฌ๊ธฐ์์ API ํค๋ฅผ ์์ฑํ ์ ์๋ ์ต์ ์ด ํ์๋ฉ๋๋ค.
- ์์ฑ๋ API ํค๋ฅผ ๋ณต์ฌํ์ฌ ์์ ํ ๊ณณ์ ์ ์ฅํฉ๋๋ค.
API ํค๋ ๊ฐ ์ฌ์ดํธ๋ง๋ค ๊ณ ์ ํฉ๋๋ค. ๋ค๋ฅธ ์ฌ์ดํธ์ ์ ์ฉํ๋ ค๋ฉด ๋ณ๋์ ํค๋ฅผ ๋ฐ๊ธ๋ฐ์์ผ ํ๋ฉฐ, ๋ฐ๊ธ๋ฐ์ API ํค๋ ๋ณด์์ ์ฃผ์ํด์ผ ํฉ๋๋ค.
2. API ํค ํธ์คํ
- ์์ฑํ API ํค๋ ์น์ฌ์ดํธ์ ๋ฃจํธ ๋๋ ํ ๋ฆฌ์ UTF-8 ํ์์ ํ ์คํธ ํ์ผ๋ก ํธ์คํ ํด์ผ ํฉ๋๋ค.
- ์๋ฅผ ๋ค์ด,
https://www.example.com/b9d89505474244e4898ec830e96aed1e.txt
์ ๊ฐ์ ๊ฒฝ๋ก์ ํ์ผ์ ์ ๋ก๋ํ๊ณ , ํ์ผ ๋ด์ฉ์๋ ์์ฑํ API ํค๋ฅผ ํฌํจ์ํต๋๋ค.
3. URL ์ ์ถ
- URL์ ์ ์ถํ๊ธฐ ์ํด JSON ํ์์ผ๋ก HTTP POST ์์ฒญ์ ๋ณด๋ ๋๋ค. ์์ฒญ์ ๊ตฌ์กฐ๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
- ์ด ์์ฒญ์ ํตํด ์ฌ๋ฌ ๊ฐ์ URL์ ํ ๋ฒ์ ์ ์ถํ ์ ์์ต๋๋ค.
{ "host": "www.example.org", "key": "b9d89505474244e4898ec830e96aed1e", "keyLocation": "https://www.example.org/b9d89505474244e4898ec830e96aed1e.txt", "urlList": [ "https://www.example.org/url1", "https://www.example.org/folder/url2", "https://www.example.org/url3" ] }
4. HTTP ์๋ต ํ์ธ
์์ฒญ ํ ์๋ฒ๋ ๋ค์ํ HTTP ์๋ต ์ฝ๋๋ฅผ ๋ฐํํฉ๋๋ค. ๊ฐ ์ฝ๋์ ์๋ฏธ๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
- 200 (OK): URL ์ ์ถ ์ฑ๊ณต
- 400 (Bad Request): ์๋ชป๋ ํ์
- 403 (Forbidden): ์ ํจํ์ง ์์ ํค
- 422 (Unprocessable Entity): URL์ด ํธ์คํธ์ ์ํ์ง ์๊ฑฐ๋ ํค๊ฐ ์ผ์นํ์ง ์์
- 429 (Too Many Requests): ์์ฒญ์ด ๋๋ฌด ๋ง์
5. URL ํ์ธ
- Bing Webmaster Tools๋ฅผ ์ฌ์ฉํ์ฌ ์ ์ถํ URL์ด ๊ฒ์ ์์ง์ ์ ๋๋ก ์ ๋ฌ๋์๋์ง ํ์ธํ ์ ์์ต๋๋ค. ์ด๋ฅผ ํตํด ์ ์ถ ์ํ๋ฅผ ๋ชจ๋ํฐ๋งํ ์ ์์ต๋๋ค.
RSS ๋ฅผ ์ด์ฉํด์ ์๋ ๋ฐ์กํ๊ธฐ
์๋์ผ๋ก ํ์ด์ง๊ฐ ๋ก๋๋ ๋ ๋ง๋ค ์ผ์ ๊ธฐ๊ฐ์ ์ค์ ํด์ ์๋์ผ๋ก ์์ธ ์์ฒญ์ ์งํํ ์ ์์ต๋๋ค. ์๋ ์คํฌ๋ฆฝํธ ํ์ผ์ ์ฌ์ดํธ์ API ํค, RSS ์ฃผ์๋ฅผ ์์ ํด์ HTML ํค๋์ ๋ฃ์ด์ฃผ์๋ฉด ๋ฉ๋๋ค.
- ํ์ด์ง๊ฐ ๋ก๋๋ ๋ URL ์ ์ถ์ ํ๋ฃจ์ ํ ๋ฒ๋ง ์คํํ๋๋ก ์ค์ ํ ์ ์์ต๋๋ค.
- ์ด๋ฅผ ์ํด ๋ก์ปฌ ์คํ ๋ฆฌ์ง์ ๋ง์ง๋ง ์คํ ์๊ฐ์ ์ ์ฅํ๊ณ , ํ์ฌ ์๊ฐ๊ณผ ๋น๊ตํ์ฌ ํ๋ฃจ๊ฐ ๊ฒฝ๊ณผํ๋์ง๋ฅผ ํ์ธํฉ๋๋ค. ์ด๋ฌํ ๋ฐฉ์์ ์ค๋ณต ์์ฒญ์ ๋ฐฉ์งํ๋ฉฐ, ํจ์จ์ ์ธ URL ์ ์ถ์ ๋ณด์ฅํฉ๋๋ค.
์ด์ ๊ฐ์ ์ ์ฐจ๋ฅผ ํตํด IndexNow๋ฅผ ํจ๊ณผ์ ์ผ๋ก ํ์ฉํ์ฌ ์น์ฌ์ดํธ์ URL์ ๊ฒ์ ์์ง์ ์ ์ํ๊ฒ ์ ์ถํ ์ ์์ต๋๋ค.
async function fetchRssUrls(rssUrl) {
const response = await fetch(rssUrl);
const text = await response.text();
const parser = new DOMParser();
const xmlDoc = parser.parseFromString(text, "application/xml");
const urls = Array.from(xmlDoc.getElementsByTagName("link")).map(link => link.textContent);
return urls;
}
async function submitUrlsToIndexNow(rssUrl) {
const apiKey = 'b9d89505474244e4898ec830e96aed1e';
const keyLocation = 'https://www.example.com/b9d89505474244e4898ec830e96aed1e.txt'; // ํธ์คํ
๋ ํค ํ์ผ์ URL
const host = 'www.example.com'; // ๊ทํ์ ๋๋ฉ์ธ
// RSS ํผ๋์์ URL ๊ฐ์ ธ์ค๊ธฐ
const urls = await fetchRssUrls(rssUrl);
const requestBody = {
host: host,
key: apiKey,
keyLocation: keyLocation,
urlList: urls
};
try {
const response = await fetch('https://api.indexnow.org/indexnow', {
method: 'POST',
headers: {
'Content-Type': 'application/json; charset=utf-8'
},
body: JSON.stringify(requestBody)
});
const result = await response.json();
if (response.ok) {
console.log('URLs submitted successfully:', result);
} else {
console.error('Error submitting URLs:', result);
}
} catch (error) {
console.error('Fetch error:', error);
}
}
function shouldRunOnceADay() {
const lastRun = localStorage.getItem('lastIndexNowRun');
const now = Date.now();
// ํ๋ฃจ (24์๊ฐ) ๋ฐ๋ฆฌ์ด
const oneDay = 24 * 60 * 60 * 1000;
if (!lastRun || (now - lastRun) > oneDay) {
localStorage.setItem('lastIndexNowRun', now);
return true;
}
return false;
}
// ํ์ด์ง ๋ก๋ ์ ์คํ
window.addEventListener('load', () => {
const rssFeedUrl = 'https://example.com/rss'; // RSS ํผ๋ URL
if (shouldRunOnceADay()) {
submitUrlsToIndexNow(rssFeedUrl);
} else {
console.log('Already executed today.');
}
});
์ธ๋ฑ์ค๋์ฐ๋ ์ผ๋ถ ๋ธ๋ก๊ทธ(ํฐ์คํ ๋ฆฌ)์์๋ ์ฌ์ฉ์ ํ ์ ์์ต๋๋ค.