Architecture Overview
The theme is built on four main building blocks:Templates
Define page structure and layout using HubL
Modules
Reusable content components with fields
Macros
Utility functions for common operations
Sections
Drag-and-drop layout components
Templates
Templates define the overall page structure and use HubL (HubSpot Markup Language) to create dynamic pages.Template Types
- Layouts
- Partials
- System
Base templates that define the common HTML structure:
templates/layouts/base.html
Templates use HubL blocks (
{% block %}) to create inheritance hierarchies and allow child templates to override specific sections.Modules
Modules are self-contained components that editors can add to pages. Each module consists of multiple files:Module Structure
Every module lives in its own.module directory:
Module Example
Available Modules
FreshJuice DEV includes 30+ modules organized by category:Content & Media
Content & Media
- card - Content card with image and text
- flip-cards - Interactive flip card component
- list - Customizable list component
- lite-youtube - Optimized YouTube embed
- lite-vimeo - Optimized Vimeo embed
- codepen - CodePen embed
- github-gist - GitHub Gist embed
Navigation & Layout
Navigation & Layout
Forms & Buttons
Forms & Buttons
Blog Components
Blog Components
- blog-listing - Blog post listing
- blog-listing-hero - Hero blog listing
- blog-pagination - Pagination controls
- related-posts - Related posts widget
Interactive Components
Interactive Components
- accordion - Collapsible content sections
- tabs - Tabbed content interface
- google-maps - Google Maps embed
Testimonials & Social
Testimonials & Social
Pricing & Stats
Pricing & Stats
- pricing-card - Individual pricing card
- pricing-cards - Pricing comparison
- price-card-with-details - Detailed pricing
- stats-simple - Simple statistics
- stats-simple-grid - Grid statistics
- stats-timeline - Timeline statistics
Macros
Macros are reusable HubL functions that perform common operations. They’re similar to functions in traditional programming.Available Macros
Using Macros
Import and use macros in your templates or modules:Sections
Sections are drag-and-drop layout components that use HubSpot’s DnD (Drag and Drop) areas.Section Example
Available Sections
- hero-banner.html - Hero section with image and content
- call-to-action.html - CTA section
- cards.html - Card grid layout
- multi-column-content.html - Multi-column layouts
- row-content-img-left.html - Content with left image
- row-content-img-right.html - Content with right image
- pricing.html - Pricing section
Sections provide pre-built layouts that content editors can customize without touching code. They’re perfect for creating flexible page builders.
How They Work Together
Templates provide structure
Base templates (
layouts/base.html) define the overall HTML structure with header, main content area, and footer.Partials handle common elements
Header and footer partials are included using
{% global_partial %} to ensure consistency across pages.Sections create page layouts
Drag-and-drop sections allow editors to build page layouts without coding.
Modules add content components
Individual modules can be added to sections or directly to pages for specific functionality.
Best Practices
Module Organization
- One component per module
- Clear, descriptive names
- Consistent field naming
- Include module icons for better UX
Macro Guidelines
- Document parameters clearly
- Provide usage examples
- Keep macros pure (no side effects)
- Use descriptive variable names
Template Structure
- Use template inheritance
- Keep partials DRY
- Document block usage
- Consistent naming conventions
Section Design
- Mobile-first responsive design
- Provide context defaults
- Include preview screenshots
- Clear descriptions for editors
Related Resources
Project Structure
Understand the directory organization
Build Process
Learn about the compilation pipeline