自定义主题的Blueprints在Admin插件中完全无法被检测到
To set up a custom page blueprint for a gallery in your Grav theme, here's a step-by-step breakdown of what you've implemented:
Create the blueprint file: Navigate to your theme's blueprints directory (
user/themes/MYTHEMENAME/blueprints) and create a file namedvideo.yaml. (Pro tip: Since the blueprint's title is "Gallery", renaming the file togallery.yamllater will help keep things consistent.)Add the blueprint configuration: Here's your YAML content formatted properly, with a note to finish the incomplete select field:
title: Gallery '@extends': type: default context: blueprints://pages form: fields: tabs: type: tabs active: 1 fields: gallery: type: tab title: Gallery fields: header.txf: type: text label: Add a number default: 5 validate: required: true type: int header.sb: type: select label: Select one of the following # You'll need to complete this section! Example structure: # default: option_1 # options: # option_1: First Choice # option_2: Second Choice
Key Details About This Setup:
- The
@extendsdirective pulls in all fields from Grav's default page blueprint, so you don't have to redefine basic settings like page title or content area. - The
header.txffield is a required integer input with a default value of 5 – this lets editors input a number that gets stored in the page's header data. - The
header.sbselect field is partially complete; you'll need to add thedefaultvalue and a list ofoptionsfor editors to choose from (the comment above shows how to structure this).
Once you save this file, the new "Gallery" tab will appear in the Grav admin whenever you create or edit a page using this blueprint.
内容的提问来源于stack exchange,提问作者Alexander Kim

