ElMassimo / iles

๐Ÿ The joyful site generator
https://iles.pages.dev
MIT License
1.08k stars 31 forks source link

feat: improve extendRoute to have access to the frontmatter #56

Closed ElMassimo closed 2 years ago

ElMassimo commented 2 years ago

Description ๐Ÿ“–

This pull request replaces this fork of vite-plugin-pages with a new @islands/pages module in order to provide a better experience when customizing frontmatter or routes.

The @islands/frontmatter module is now discontinued, and its functionality was moved to @islands/mdx.

Features โœจ

Bug Fixes ๐Ÿž

Breaking Changes ๐Ÿ’ฃ


@islands/pages

An รฎles module that provides support for pages, inspired by vite-plugin-pages.

  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:

Acknowledgements

netlify[bot] commented 2 years ago

โœ”๏ธ Deploy Preview for iles-docs canceled.

๐Ÿ”จ Explore the source changes: 959a518cc19c79d3f7428b6380dbb3b3cd3a0c67

๐Ÿ” Inspect the deploy log: https://app.netlify.com/sites/iles-docs/deploys/61b24babf601250008699ea3

netlify[bot] commented 2 years ago

โœ”๏ธ Deploy Preview for the-vue-point-with-iles canceled.

๐Ÿ”จ Explore the source changes: 959a518cc19c79d3f7428b6380dbb3b3cd3a0c67

๐Ÿ” Inspect the deploy log: https://app.netlify.com/sites/the-vue-point-with-iles/deploys/61b24babf4b8860008371bf5

cloudflare-pages[bot] commented 2 years ago

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 959a518
Status:โšก๏ธ  Build in progress...

View logs