SEO Rich Snippets - Configuration
This document provides complete instructions for configuring the SEO Rich Snippets module in Magento 2.
Initial configuration
Module is disabled by default and needs to be enabled in the Admin Panel.
Admin Panel Configuration
Enabling the Module
- Log into the Admin Panel
- Navigate to:
Stores→Configuration→Qoliber→SEO: Rich Snippets - Open the
Settingssection - Set
Enabledto Yes - Click Save Config
- Flush caches
Debug Mode
The module supports different rendering modes for the JSON-LD output:
Available Modes:
- minified (Default) - Compact JSON output, recommended for production
- pretty - Pretty-printed JSON with indentation, useful for debugging
- disabled - No JSON-LD output
To configure:
- Navigate to:
Stores→Configuration→Qoliber→SEO: Rich Snippets - Open the
Settingssection - Set
Debug Modeto your preferred option - Click Save Config
Production Settings
Always use minified mode in production for optimal page load performance.
Managing Snippets
Accessing Snippet Management
Navigate to: Content → SEO Rich Snippets → Snippets
This grid shows all snippets with: - Name and identifier - Active status - Page types where the snippet appears - Store views - Actions (Edit/Delete)
Creating a New Snippet
- Click Add New Snippet button
- Fill in the required fields (see below)
- Click Save
- Flush caches
Snippet Configuration Fields
General Information
Name (Required) - Display name for the snippet in admin - Example: "Product Schema", "Organization Info"
Identifier (Required)
- Unique identifier for referencing in templates
- Used in {{snippet.identifier}} syntax
- Lowercase, alphanumeric, hyphens only
- Example: product-schema, organization
Active (Required) - Enable/disable the snippet - Options: Yes/No - Inactive snippets are not rendered
Store View (Required) - Select which store views should display this snippet - Multi-select field - Choose "All Store Views" for global snippets
Page Targeting
You can target snippets to appear on specific pages using one or more methods:
Page Types (Multi-select)
- homepage - Store homepage
- product - Product detail pages
- category - Category listing pages
- cms - CMS pages (use CMS Page IDs for specific pages)
- contact - Contact page
- search - Search results page
CMS Page IDs (Multi-select) - Select specific CMS pages - Only applies when page type is "cms" or left empty - Example: About Us, Terms & Conditions pages
Custom URL Pattern
- Match pages by URL pattern
- Supports wildcards with *
- Examples:
- /sale/* - All URLs starting with /sale/
- /blog/*/view - Blog post detail pages
- /special-offer - Exact match
Custom Handle
- Match by Magento layout handle
- Exact match only
- Examples:
- catalog_product_view
- cms_index_index
- catalog_category_view
Targeting Priority
If multiple targeting methods are used, the snippet will appear if any condition matches (OR logic).
JSON Schema Template
JSON Schema (Required)
- The JSON-LD template with variables and DJson syntax
- Supports:
- Variables: {{variable.name}}
- Nested snippets: {{snippet.identifier}}
- Conditionals: @djson if condition
- Loops: @djson for collection as item
See DJson Syntax for complete reference.
Store Configuration Requirements
For the default snippets to work properly, configure these Magento settings:
Store Information
Path: Stores → Configuration → General → Store Information
Required fields: - Store Name - Used in Organization and LocalBusiness schemas - Store Phone Number - Contact information - Store Address: - Street Address (Line 1) - City - ZIP/Postal Code - Country
Store Email Addresses
Path: Stores → Configuration → General → Store Email Addresses
Required fields: - General Contact - Sender Name - Sender Email
Logo
Path: Content → Design → Configuration → Select Store View → Edit
Upload your logo to: pub/media/logo/default/logo.svg
Or configure the logo path in the snippet template.
Default Snippet Configuration
After installation, review and enable the default snippets:
Always Enabled
These snippets should generally remain active:
-
Organization (Homepage)
- Company information
- Requires: Store name, phone, email, address
-
WebSite (Homepage)
- Search box functionality
- Requires: Base URL
-
Product (Product Pages)
- Product details with offers and reviews
- Requires: Product data (automatic)
Enable as Needed
-
BreadcrumbList (Product/Category Pages)
- Navigation breadcrumbs
- Automatic data from page breadcrumbs
-
LocalBusiness (Contact Page)
- Physical store location
- Requires: Store information, opening hours configuration
-
FAQPage (FAQ Pages)
- Frequently asked questions
- Requires: Manual configuration with questions/answers
Testing Rich Snippets
Google Rich Results Test
- Visit Google Rich Results Test
- Enter your product/page URL
- Click Test URL
- Review detected structured data
- Fix any errors or warnings
Manual Testing
- Visit a page where snippet should appear
- View page source (Ctrl+U / Cmd+U)
- Search for
application/ld+json - Verify JSON structure is valid
- Check that variables are resolved (no
{{...}}remaining)
Debug Mode Testing
- Enable pretty debug mode
- Visit page
- View source
- JSON will be formatted with indentation for easy reading
Common Configuration Scenarios
Scenario: Different Snippets Per Store View
-
Create snippet for Store View A
- Select only "Store View A" in Store View field
- Configure language-specific content
-
Duplicate snippet for Store View B
- Change identifier (e.g.,
product-schema-de) - Select only "Store View B"
- Translate content
- Change identifier (e.g.,
Scenario: Custom Product Page URL
If using custom product URL structure:
- Edit Product snippet
- Clear Page Types
- Set Custom URL Pattern:
/products/* - Save
Scenario: Disable Reviews
- Edit Product snippet
- Remove the
@djson if product.reviewCountsection - Save
- Reviews will no longer appear in schema
Scenario: Add Custom Fields
To add custom product attributes:
- Edit Product snippet
- Add variable:
{{product.your_attribute_code}} - Save
- Attribute value will be automatically resolved
Troubleshooting
Snippet Not Appearing
- Check snippet is Active: Yes
- Verify Store View is correct
- Check page targeting settings match current page
- Flush all caches
- Check page source for
application/ld+json
Variables Not Resolving
- Enable pretty debug mode
- Check for remaining
{{...}}in output - Verify variable path is correct (see Variables Reference)
- Check debug logs:
var/log/debug.log
Invalid JSON
- Use JSONLint to validate
- Check for missing commas
- Verify DJson syntax is correct
- Check for unescaped quotes in content
Performance Issues
- Use minified mode in production
- Disable unused snippets
- Avoid complex nested loops
- Cache configuration properly
Best Practices
- Start with defaults - Review and customize pre-installed snippets before creating new ones
- Test thoroughly - Always test with Google Rich Results Test
- Keep it simple - Start with basic snippets, add complexity as needed
- Use conditions - Hide optional sections with
@djson ifwhen data might not exist - Minify in production - Only use pretty mode for debugging
- Document changes - Add comments in snippet names for custom modifications
- Version control - Export/backup snippet JSON before major changes
Next Steps
- Review Variables Reference for all available variables
- Learn DJson Syntax for advanced templating
- Explore Default Snippets examples
- Read Advanced Topics for custom development