Template System Overview
Templates are stored inpackages/templates/src/raw/ with each template containing:
- Pages - Complete page designs with elements
- Metadata - Title, description, tags, colors
- Animations - Pre-configured animations
- Assets - Images, fonts, and media
packages/templates/src/raw/
Available Templates
Templates cover various categories:- Travel - “12 Hours in Barcelona”, “Ace Hotel Kyoto Review”
- Food - “Baking Bread Guide”, cooking tutorials
- Entertainment - “Album Releases”, “Almodos Films”
- Lifestyle - “A Day in the Life”, “Art Books Gift Guide”
- Automotive - “All About Cars”
Template names and availability are based on the raw template files in the source code.
Using Templates
Browsing Templates
Templates can be browsed from the WordPress dashboard before creating a story. The template browser shows:- Template preview thumbnails
- Template metadata (title, description)
- Page count and category
Creating from Template
When you select a template:Template Structure
Template Metadata
Templates include metadata for organization and display:packages/templates/src/types.ts
Template Pages
Each page in a template contains:- Elements - Text, images, shapes, videos
- Background - Solid colors, gradients, or images
- Animations - Element entrance effects
- Page Template Type - For page template filtering (optional)
Page Template Types
Pages can be categorized for use in page templates:packages/story-editor/src/components/library/panes/pageTemplates/constants.js:22-30
Template Loading
Templates are loaded through thegetTemplates function:
packages/templates/src/getTemplates.ts
Customizing Templates
Replace Images
- From Media Library
- Upload New
- Select an image element
- Open the Media pane
- Click a new image to replace it
Edit Text
Double-click any text element to enter edit mode:- Change text content
- Adjust font, size, and color
- Modify alignment and spacing
packages/story-editor/src/components/canvas/editElement.js
Modify Colors
Templates include color palettes that can be modified:- Select an element
- Open the Design panel
- Choose from preset colors or use the color picker
- Colors update across similar elements
Adjust Animations
Template animations can be modified or removed:- Select an animated element
- Open the Animation panel
- Choose a different effect or adjust timing
- Remove animation by selecting “None”
Template Previews
Preview System
Templates render previews using the same mechanism as the editor:docs/page-templates.md:37-40
Animation Previews
Template previews include animations to show the full experience:- Entrance animations play on preview
- Timing matches final output
- Both WAAPI and AMP animations are generated
Creating Custom Templates
Templates are defined in JSON format:External Template Creation
For creating templates outside the core plugin, see the external template creation guide. Reference:docs/external-template-creation.md
Template Constants
Template configuration constants:packages/templates/src/constants.ts
Template vs Page Template
- Story Template
- Page Template
Complete multi-page story
- Contains all pages and elements
- Used to start a new story
- Includes all images and assets
- Creates a complete story structure
Best Practices
Next Steps
Page Templates
Use individual page designs in your stories
Media Library
Replace template images with your own
Animations
Customize template animations
Text & Styling
Modify fonts and colors