Create a hidden template#

A hidden template doesn't appear in Cookieplone's menu, but you can still run it by its ID. Hide templates that a post-generation hook generates, templates that aren't ready yet, and tools for the repository's maintainers.

The examples on this page come from the example repository docs/_examples/template-features/ in the Cookieplone source tree.

Hide a template#

In the repository's cookieplone-config.json, set "hidden": true on the template:

{
  "templates": {
    "internal": {
      "path": "./templates/internal",
      "title": "Internal tool",
      "description": "A template for maintainers.",
      "hidden": true
    }
  }
}

A hidden template still belongs to exactly one group, like every other template.

Hide a group#

Set "hidden": true on a group to hide the group together with all its templates:

{
  "groups": {
    "internal": {
      "title": "Internal",
      "description": "Templates for maintainers.",
      "templates": ["internal"],
      "hidden": true
    }
  }
}

A visible group whose templates are all hidden doesn't appear in the menu either.

The complete configuration of the example repository has a visible group and a hidden one:

{
  "version": "1.0",
  "title": "Example templates",
  "description": "Templates used in the Cookieplone documentation.",
  "groups": {
    "add-ons": {
      "title": "Add-ons",
      "description": "Generators that create an add-on.",
      "templates": ["features"]
    },
    "internal": {
      "title": "Internal",
      "description": "Templates for maintainers.",
      "templates": ["internal"],
      "hidden": true
    }
  },
  "templates": {
    "features": {
      "path": "./templates/features",
      "title": "Template features",
      "description": "Validators, computed fields, and filters."
    },
    "internal": {
      "path": "./templates/internal",
      "title": "Internal tool",
      "description": "A template for maintainers.",
      "hidden": true
    }
  }
}

Run a hidden template#

Pass the template ID to Cookieplone:

COOKIEPLONE_REPOSITORY=./my-templates uvx cookieplone internal

Cookieplone runs a template selected by ID whether it's hidden or not.

Show hidden templates in the menu#

Pass --all, or its short form -a:

COOKIEPLONE_REPOSITORY=./my-templates uvx cookieplone --all

The menu then includes hidden groups and hidden templates.