This directory contains example Handlebars templates for the bravo-handlebars-content extension. These templates
demonstrate how to create content element templates that work with the extension's data processors.
- ce-text.hbs - Text content element with optional header
- ce-textmedia.hbs - Text with media (images, videos, audio)
- ce-header.hbs - Standalone header element
- ce-html.hbs - Raw HTML content element
- ce-uploads.hbs - File downloads/uploads list
- ce-menu.hbs - Navigation menu
- ce-shortcut.hbs - Content shortcuts/references
- ce-plugin.hbs - Plugin/extension content
- partials/media/item.hbs - Media item partial for different media types (image, YouTube, Vimeo, audio, video)
- Copy the templates you need to your extension's template directory
- Configure the template paths in your TypoScript:
plugin.tx_handlebars {
view {
templateRootPaths {
10 = EXT:your_extension/Resources/Private/Templates/
}
partialRootPaths {
10 = EXT:your_extension/Resources/Private/Partials/
}
}
}
- Configure your content elements to use the templates:
tt_content.text =< handlebarsContent.default
tt_content.text {
templateName = @ce-text
dataProcessing {
10 = ceText
}
}
Each content element template includes:
- Semantic CSS classes following BEM methodology
- Conditional
idattribute using content element UID - Frame classes for styling variations
- Proper HTML5 semantic structure
Templates expect data processed by the extension's data processors:
headlines- Processed header data with layout and linkingbodytext- Processed RTE contentassets- Processed media filesframe_class- CSS classes for wrapper stylinguid- Content element unique identifier
Media items are processed through the handlebarsMedia processor and rendered using the media/item partial.
Supported media types:
- Images - With responsive srcset and lazy loading
- YouTube videos - With privacy-friendly embedding
- Vimeo videos - With preview images
- Audio files - HTML5 audio player
- Video files - HTML5 video player
- Other files - Download links
These templates are starting points. Customize them for your project by:
- Styling - Add your own CSS classes and structure
- Content - Modify the HTML output to match your design
- Data - Add custom data processors for additional functionality
- Accessibility - Enhance ARIA attributes and semantic markup
- Use semantic HTML5 elements
- Include proper ARIA attributes for accessibility
- Implement responsive design patterns
- Follow consistent naming conventions
- Add loading="lazy" for images below the fold
- Include fallback content for media elements
- Escape user content appropriately (use
{{}}for escaped,{{{}}}for unescaped HTML)