<template>
  <ul>
    <slot
      v-for="page of $site.pages
        .filter(page => page.regularPath.match(new RegExp(`^${ path }.`)))
        .slice(0, limit)
      "
      :page="page"
    >
      <li>
        <router-link :to="page.regularPath">{{ page.title }}</router-link>
      </li>
    </slot>
  </ul>
</template>

<script>
export default {
  name: "FolderList",
  props: {
    path: String,
    limit: {
      type: Number,
      default: 8,
    },
  },
};
</script>
