usePages
usePages returns metadata for all pages in the site and is handy for building custom overview pages such as a blog index.
- Type:
() => { pages: PageData['pages'] }
Below is a real-world example showing how to retrieve blog posts located at /blog/* in the current language from the /blog/index page, sorted in descending order by the date field in Frontmatter:
usePagesdoes not support HMR; restart the dev server after adding or removing documents to update the list.