permalink: generateCategoryPath()

in plugins/blog-plugin.js [29:69]


      permalink: generateCategoryPath(label),
      count: allBlogPosts.filter((v) => v.metadata.frontMatter.category === label).length,
    };
  });

  return lodash.uniqBy(categories, 'label');
}

function getAllTags(blogTags){
  const tagsProp = Object.values(blogTags).map((tag) => ({
    label: tag.label,
    permalink: tag.permalink,
    count: tag.items.length,
  }));
  return Array.from(new Set(tagsProp));
}

// paginate blog posts
function paginateBlogPosts({
  filtedBlogPosts,
  basePageUrl,
  blogTitle,
  blogDescription,
  postsPerPageOption,
}) {
  const totalCount = filtedBlogPosts.length;
  const postsPerPage =
    postsPerPageOption === "ALL" ? totalCount : postsPerPageOption;

  const numberOfPages = Math.ceil(totalCount / postsPerPage);

  const pages = [];

  function permalink(page) {
    return page > 0
      ? utils.normalizeUrl([basePageUrl, `page/${page + 1}`])
      : basePageUrl;
  }

  for (let page = 0; page < numberOfPages; page += 1) {
    pages.push({