Introduction
Learn about section templates in Glood.AI
Section Templates
Section templates in Glood.AI are the building blocks for displaying product recommendations in your Shopify store. They function similarly to Shopify themes, allowing you to create custom layouts and designs for your product recommendations.
What are Section Templates?
Section templates are modular components that determine how your product recommendations are displayed. They are:
-
Similar to Shopify Themes: They follow the same principles as Shopify themes, using Liquid templating for dynamic content rendering.
-
JavaScript-Powered: Templates are loaded dynamically using JavaScript through the Glood.AI app embed, which handles recommendation fetching and rendering.
-
Headless Compatible: While templates are primarily for traditional Shopify stores, headless stores and Hydrogen apps can use our headless APIs instead.
-
Multi-Component Structure: Each template consists of:
- Liquid templates for markup
- JavaScript for interactivity
- CSS for styling
- Settings schema for customization
- Translation strings for internationalization
-
Flexible Rendering: Templates can be rendered either on the frontend or backend, depending on your needs and configuration.
-
Extensible: We provide built-in Tags, Filters, and JavaScript Hooks for easy customization and third-party app integration.
Template Components
A basic section template includes these core components:
Template Features
1. Settings Schema
- Configurable options for layout, styling, and behavior
- Support for various input types (text, select, color, etc.)
- Section-specific configurations
2. Translations
- Multi-language support
- Customizable text strings
- Fallback handling for missing translations
3. Liquid Markup
- Dynamic content rendering
- Built-in filters for data manipulation
- Conditional rendering and loops
4. JavaScript
- Event handling
- DOM manipulation
- API integrations
- Cart operations
5. CSS
- Responsive layouts
- Custom styling
- Animation support
- Theme compatibility
Extension Points
We provide several ways to extend and customize templates:
-
Tags: Custom Liquid tags for template functionality
-
Filters: Data manipulation filters
-
Hooks: JavaScript hooks for lifecycle events
Best Practices
-
Performance
- Optimize images and assets
- Minimize JavaScript execution time
- Use efficient selectors
- Implement lazy loading
-
Compatibility
- Test across different themes
- Ensure mobile responsiveness
- Handle edge cases gracefully
- Support various browser versions
-
Maintainability
- Follow naming conventions
- Document custom functionality
- Use modular code structure
- Implement error handling
-
Accessibility
- Use semantic HTML
- Add ARIA attributes
- Ensure keyboard navigation
- Provide alt text for images
Libraries
The section template system uses the following core libraries that you’ll interact with when customizing templates:
Core Libraries
Our UI library for building interactive components.
Key Features:
- React-compatible API
- Lightweight (3kB)
- Virtual DOM
- Component-based architecture
Our UI library for building interactive components.
Key Features:
- React-compatible API
- Lightweight (3kB)
- Virtual DOM
- Component-based architecture
Powers carousel functionality in templates.
Common Uses:
- Product carousels
- Image galleries
- Touch-enabled sliders
- Responsive layouts
Template engine for rendering Shopify-compatible templates.
Features:
- Shopify Liquid syntax
- Custom tags and filters
- Theme compatibility
Next Steps
- Learn about Filters for data manipulation
- Explore Tags for template functionality
- Understand Hooks for JavaScript integration
- Check out Template Structure for detailed component information
Support
If you need help with creating or customizing section templates, contact our support team at support@glood.ai
Was this page helpful?