Astro 6의 Live Content Collections는 빌드 때 고정하는 컬렉션과 달리 요청 시 외부 데이터 소스에서 콘텐츠를 읽습니다. CMS에서 글이 바뀌면 다음 요청에 새 데이터를 반영할 수 있습니다.
요청마다 외부 소스에 의존하므로 지연과 장애 대응을 고려해야 합니다. 변경이 드문 콘텐츠라면 빌드 시 컬렉션이 더 단순하고 빠를 수 있습니다.
언제 쓰나
CMS 콘텐츠가 자주 바뀌고 재빌드 없이 바로 반영해야 할 때 사용합니다.
Astro 6은 외부 콘텐츠를 요청 시 읽어 재빌드 없이 다음 화면에 반영할 수 있습니다.
<section class="stage"><div class="heading">LIVE CONTENT <span class="hint">publish → next request</span></div><div class="live"><div class="tile cms">CMS <b id="cms-version">v1</b></div><div class="arrow">→</div><div class="tile request">REQUEST</div><div class="arrow">→</div><div class="tile view">PAGE <b id="page-version">v1</b></div></div><div class="caption">The page follows content changes without a build</div></section>.stage{width:min(94vw,780px);height:min(88vh,322px);padding:clamp(12px,3vmin,20px);border:1px solid var(--line);border-radius:16px;background:var(--surface);box-shadow:0 12px 36px #0001;display:flex;flex-direction:column;gap:clamp(7px,2vmin,14px);font:500 clamp(12px,3.5vmin,17px)/1.3 var(--font-sans,system-ui,sans-serif);overflow:hidden}.heading{display:flex;justify-content:space-between;align-items:center;gap:8px;font-weight:750;color:var(--accent)}.hint{color:var(--muted);font-size:clamp(12px,3.2vmin,14px);font-weight:500}.caption{margin-top:auto;color:var(--muted);font-size:clamp(12px,3.2vmin,14px)}.row{display:flex;gap:clamp(5px,1.5vmin,12px);align-items:center}.tile{padding:clamp(6px,1.8vmin,13px);border:1px solid var(--line);border-radius:9px;background:var(--bg);text-align:center;min-width:0}.arrow{color:var(--accent);font-weight:800}.stage [data-on]{transition:background .3s,border-color .3s,opacity .3s,transform .3s}.stage .on{border-color:var(--accent);background:color-mix(in srgb,var(--accent) 14%,var(--surface));color:var(--accent)}.live{flex:1;display:flex;align-items:center;justify-content:center;gap:clamp(3px,1.1vmin,12px)}.live .tile{flex:1;max-width:140px;min-width:0;min-height:70px;display:flex;flex-direction:column;align-items:center;justify-content:space-around}.live b{color:var(--accent);font-size:1.15em}.request{border-color:var(--accent-2)}.stage[data-step="1"] .cms,.stage[data-step="2"] .cms{border-color:var(--accent-3)}.stage[data-step="2"] .view{border-color:var(--accent)}.stage small,.stage button,.stage .cards b,.stage .phase b,.stage .pair b,.stage .tree-mini b{font-size:clamp(12px,3.2vmin,14px)!important}const stage=document.querySelector(".stage"),cms=document.getElementById("cms-version"),page=document.getElementById("page-version");let step=0;function tick(){stage.dataset.step=String(step);cms.textContent=step>=1?"v2":"v1";page.textContent=step===2?"v2":"v1";step=(step+1)%3}tick();let timer=setInterval(tick,1000);stage.addEventListener("pointerdown",()=>{clearInterval(timer);tick()})Astro 6의 Live Content Collections는 빌드 때 고정하는 컬렉션과 달리 요청 시 외부 데이터 소스에서 콘텐츠를 읽습니다. CMS에서 글이 바뀌면 다음 요청에 새 데이터를 반영할 수 있습니다.
요청마다 외부 소스에 의존하므로 지연과 장애 대응을 고려해야 합니다. 변경이 드문 콘텐츠라면 빌드 시 컬렉션이 더 단순하고 빠를 수 있습니다.
CMS 콘텐츠가 자주 바뀌고 재빌드 없이 바로 반영해야 할 때 사용합니다.