-- SSR 에서 XML 사이트맵을 만든다 (next-sitemap, Pages Router)
-- withXMLResponseLegacy 는 next-sitemap 소스(src/ssr/response.ts)의 동작 그대로다
getServerSideProps ctx = getServerSideSitemapLegacy ctx fields -- 필드 목록 → XML 문자열
>>= withXMLResponseLegacy ctx
withXMLResponseLegacy ctx content = do
setHeader (res ctx) "Content-Type" "text/xml"
write (res ctx) content
end (res ctx)