mercury_editor_page_templates
No security coverage
A Drupal module that provides a template system for creating pages with pre-configured layouts and content using Mercury Editor.
Overview
Streamlines page creation by providing pre-defined templates that integrate with Mercury Editor. Content creators can select templates when creating new pages, ensuring consistency and reducing setup time.
Features
- Template Management: Create, edit, and delete page templates via admin interface
- Content Type Integration: Configure templates for specific content types
- YAML Configuration: Define templates using YAML for easy editing
- Flexible Field Support: Support for any field machine name
- Region Support: Layout regions for content placement
- Mercury Editor Integration: Seamless integration with Mercury Editor
Requirements
- Drupal 10.x or 11.x
- Mercury Editor module
- Layout Paragraphs module
- Paragraphs module
- PHP 8.1+
Installation
composer require your-org/mercury_editor_page_templates
drush en mercury_editor_page_templates
Quick Start
- Configure Mercury Editor: Set up content types in Mercury Editor settings
- Create Templates: Go to Configuration > Content authoring > Mercury Editor Page Templates
- Use Templates: When creating content, select from available templates
YAML Template Example
-
type: custom_section
description: 'Main Content Section'
layout: two_column_75_25
paragraphs:
-
type: content_block
description: 'Content block with title and body in the first region'
field_config:
-
field_name: field_title
field_structure:
value: 'Welcome to Our Site'
-
field_name: field_body
field_structure:
value: 'This is the main content that appears in the first region with detailed information about our services and offerings.'
format: full_html
style_options:
background_color: 'Light Blue'
text_alignment: 'Left'
padding_size: 'Medium'
region: first
-
type: text_block
description: 'Simple text block in the second region'
field_config:
-
field_name: body
field_structure:
value: 'This is sidebar content that appears in the second region.'
format: full_html
style_options:
background_color: 'bg-light border-2'
text_alignment: 'text-center font-bold'
border_style: 'border-solid border-gray-300'
region: second
Troubleshooting
Templates not showing?
- Ensure content type is configured in Mercury Editor
- Check template is assigned to correct content type
- Validate YAML syntax
YAML errors?
- Use 2-space indentation
- Check for missing colons after field names
- Validate with online YAML validator