Filter pages

To filter pages under a specific condition

Options See on

extensions string[] *

The list of extensions this plugin applies to

fn function

The function to test the page

(page) => true


This plugin allows to filter the pages of your site using a callback.


The plugin requires a function that receives the Page instance as the first argument and must return a boolean. If it returns false, the page will be discarded. For example, to remove all pages with the property ignored=true:

import lume from "lume/mod.ts";
import filterPages from "lume/plugins/filter_pages.ts";

const site = lume();

  fn: (page) => !== true,

export default site;

Limiting which files to test

By default the plugin tests all output files: not only 'pages' but also assets like .css. You can control this with the extensions option which specifies the extensions to apply to:

  extensions: [".html", ".json"],
  fn: (page) => !== true,

This will only test output files with the extensions .html or .json, all other pages will not be tested.