피드·sitemap
RSS 2.0·Atom·JSON Feed·sitemap 을 같은 입력으로 만들고, XML 에 넣을 수 없는 글자를 걸러 피드가 통째로 깨지지 않게 한다. ETag·Last-Modified 로 304 를 판정해 다시 묻는 리더에게 본문을 보내지 않는다
npm install @duolabs-deux/unit-feed
직접 넣어 보기
<?xml version="1.0" encoding="UTF-8"?> <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> <channel> <title>예시 블로그</title> <link>https://blog.example.com/</link> <description>예시 블로그</description> <language>ko-KR</language> <lastBuildDate>Sat, 03 Oct 2026 00:00:00 GMT</lastBuildDate> <atom:link href="https://blog.example.com/rss.xml" rel="self" type="application/rss+xml"/> <item> <title>기간은 1~2주 (제어 문자가 섞인 제목)</title> <link>https://blog.example.com/a</link> <guid isPermaLink="true">https://blog.example.com/a</guid> <pubDate>Sat, 03 Oct 2026 00:00:00 GMT</pubDate> <description>가상의 글</description> </item> </channel> </rss>
이 피드의 ETag
200: 본문을 보낸다
어댑터
없다. 밖에 묻지 않고 입력만으로 결정적으로 답한다.
실패와 소비 앱이 할 일
| 종류 | 언제 | 할 일 |
|---|---|---|
invalid-input | 링크가 절대 주소가 아니거나, 날짜가 깨졌거나, sitemap 이 한도(50,000개·50MB)를 넘거나, Atom 에 저자가 없을 때 | 깨진 피드를 내보내지 말고 원인을 고친다. sitemap 은 splitSitemap 과 색인으로 나눈다 |
한도
- sitemap 한 파일은 주소 50,000개·50MB(압축 전)까지
- 본문 HTML 은 살균된 것을 넣는다. 피드는 HTML 을 고치지 않는다
- isNotModified 는 GET·HEAD 만 판정한다(다른 메서드의 사전 조건 실패는 412 이고 여기서 다루지 않는다)