Thread Pagination
Swap the widget’s
urlId
at runtime to jump between products, posts, or pages. Threads provision lazily. No pre-creation needed.
Product · 0
src/pages/paginated.astro
---
import { FastComments } from 'fastcomments-astro';
---
<button id="prev">Prev</button>
<button id="next">Next</button>
<div id="fc-slot">
<FastComments tenantId="demo" urlId="product-0" />
</div>
<script>
let page = 0;
const slot = document.getElementById('fc-slot');
const update = (d) => {
page += d;
// Paginated widgets typically swap urlId via the widget instance `update()`
// method. Grab the instance from the global registry and call update.
const inst = window.__fcInstances?.[0]?.inst;
inst?.update?.({ tenantId: 'demo', urlId: 'product-' + page });
};
document.getElementById('prev').addEventListener('click', () => update(-1));
document.getElementById('next').addEventListener('click', () => update(1));
</script>