@islands/pages
v0.10.0-beta.1
Published
<p align="center"> <a href="https://iles-docs.netlify.app"> <img src="https://github.com/ElMassimo/iles/blob/main/docs/images/banner.png"/> </a> </p>
Downloads
710
Readme
An îles module that provides support for pages, inspired by vite-plugin-pages.
- 🛣 file-based routing
- 🎣 hooks to extend frontmatter and route data
- 📄 adds support for a
<page>
block in Vue single-file components
extendFrontmatter (frontmatter, filename) {
if (filename.includes('/posts/'))
frontmatter.layout = 'post'
},
extendRoute (route) {
if (route.path.startsWith('/posts'))
route.path = path.replace(/[\d-]+/, '') // remove date
},
extendRoutes (routes) {
routes.push({ path: '/custom', name: 'Custom', componentFilename: ... }))
},
extendFrontmatter is very flexible, you could use it to:
- Infer the title or date from the filename
- Set a different layout for all pages in a specific dir
- Provide additional data to use in the page, such as
gitLastUpdated
Acknowledgements
vite-plugin-pages
: Early versions of îles used this wonderful library