+
Website Blog Email Template
+
+
+

+
This module extends the website blog functionality by allowing you to
+configure custom email templates for new blog post notifications.
+
+
Main Features
+
+- Custom Email Templates: Configure a custom email template for each
+blog to personalize notifications
+- Template Selection: Choose from existing mail templates or create
+new ones specifically for blog notifications
+- Context Access: Templates have access to blog post information
+through context variables
+- Backward Compatible: If no custom template is configured, the
+default template is used
+- Link to Post: Templates can include direct links to the published
+blog post
+
+
+
+
Benefits
+
+- Personalize email notifications for different blogs
+- Create branded email templates matching your company style
+- Include additional information in notifications (author, subtitle,
+etc.)
+- Maintain consistency with your email marketing campaigns
+- Better control over notification content and formatting
+
+
+
+
Dependencies
+
This module requires:
+
+- website_blog: Odoo’s website blog module
+
+
Table of contents
+
+
+
+
This module does not require additional configuration after
+installation. It works automatically once installed.
+
+
+
+
Installation
+
+- Go to the Apps menu
+- Remove the “Apps” filter if necessary
+- Search for “Website Blog Email Template”
+- Click Install
+
+
+
+
Prerequisites
+
Make sure the following modules are installed:
+
+- Website Blog (base blog module)
+
+
The system will automatically install the necessary dependencies during
+installation.
+
+
+
Default Template
+
After installation, a default custom template is available:
+
+- Template Name: “Blog: New Post Published (Custom Template)”
+- Location: Settings > Technical > Email > Templates
+- Model: Blog (blog.blog)
+
+
You can use this template as-is, customize it, or create new templates
+based on it.
+
+
+
Permissions
+
The module uses the same access permissions as the base modules:
+
+- Users with access to Website and Blogs can configure email
+templates for blogs
+- Users with access to Settings > Technical > Email > Templates can
+create and edit email templates
+
+
No additional permission configuration is required.
+
+
+
Template Configuration
+
Template Requirements:
+
+- Model: Must be set to “Blog” (blog.blog)
+- Subject: Can use {{ object.name }} for blog name
+- Body: HTML content with access to:
+- Blog object: object.name, object.subtitle
+- Post context: ctx.get('blog_post') for post information
+
+
+
+
Recommended Template Structure:
+
+- Include a greeting
+- Display blog name
+- Show post title and subtitle
+- Include a link to the post using ctx.get('blog_post').website_url
+- Add a closing message
+
+
+
Usage
+
This guide explains how to use the Website Blog Email Template module to
+configure custom email notifications for new blog posts.
+
+
+
+
Configure a Custom Email Template for a Blog
+
Step 1: Access Blog Settings
+
+- Go to the Website module
+- Navigate to Blogs > Blogs
+- Select the blog you want to configure
+- Open the blog form view
+
+
Step 2: Select or Create Email Template
+
+- In the blog form, locate the Email Template for New Posts field
+- You have two options:
+- Option A: Select an existing template from the dropdown
+- Option B: Create a new template (click the search icon and then
+“Create”)
+
+
+
+
Step 3: Create a New Template (if needed)
+
+- Click on the Email Template for New Posts field
+- Click the search icon (magnifying glass)
+- Click Create button
+- Fill in the template form:
+- Name: Give your template a descriptive name (e.g., “Blog Post
+Notification - Marketing”)
+- Model: Should be set to “Blog” (blog.blog)
+- Subject: Email subject line (e.g., “New post: {{ object.name
+}}”)
+- Body: HTML content of the email
+
+
+- Save the template
+- Select it in the blog’s Email Template for New Posts field
+
+
Step 4: Save the Blog Configuration
+
+- Save the blog form
+- The custom template will now be used when new posts are published
+
+
+
+
Using Context Variables in Templates
+
When creating or editing a template, you can use the following context
+variables:
+
Blog Information:
+
+- {{ object.name }} - Blog name
+- {{ object.subtitle }} - Blog subtitle
+
+
Post Information (via context):
+
+- {{ ctx.get('blog_post').name }} - Post title
+- {{ ctx.get('blog_post').subtitle }} - Post subtitle
+- {{ ctx.get('blog_post').author_name }} - Author name
+- {{ ctx.get('blog_post').website_url }} - Direct link to the post
+- {{ ctx.get('blog_post_id') }} - Post ID
+
+
Example Template Body:
+
+<div style="margin: 0px; padding: 0px; font-size: 13px;">
+ <p>Hello,<br/><br/>
+ A new post has been published on the <strong>{{ object.name }}</strong> blog:<br/><br/>
+ <strong>{{ ctx.get('blog_post').name }}</strong><br/><br/>
+ <a href="{{ ctx.get('blog_post').website_url }}">Read the full post</a>
+ </p>
+</div>
+
+
+
+
Automatic Behavior
+
Template Selection Logic
+
When a new blog post is published:
+
+- The system checks if the blog has a custom template configured
+- If a template is configured: Uses
+message_post_with_template() with the custom template
+- If no template is configured: Uses the default template
+(website_blog.blog_post_template_new_post)
+
+
Notification Recipients
+
+- Only blog followers receive the notification
+- The notification uses the subtype “Published Post”
+(mt_blog_blog_published)
+- Email layout uses “mail.mail_notification_light” for custom templates
+
+
+
+
Usage Examples
+
Example 1: Simple Custom Template
+
+- Create a blog “Company News”
+- Create a template with subject: “New article on {{ object.name }}”
+- Body includes post title and link
+- Configure the template in the blog
+- When posts are published, followers receive the custom email
+
+
Example 2: Branded Template
+
+- Create a blog “Product Updates”
+- Create a template matching your company branding
+- Include company logo, colors, and specific formatting
+- Add additional information like author bio or related posts
+- Configure in the blog settings
+
+
Example 3: Multi-language Support
+
+- Create different templates for different languages
+- Configure language-specific templates per blog
+- Templates can use language-specific formatting and content
+
+
+
+
Tips
+
+- Test your template before publishing posts by using the “Send Test
+Email” feature in the template
+- Use the default template as a reference when creating custom templates
+- Include the post link (ctx.get('blog_post').website_url) to make
+it easy for readers to access the content
+- Consider your email client compatibility when designing HTML templates
+- The template is rendered with the blog as object, so use
+object.name for blog name
+- Post information is available through context, so use
+ctx.get('blog_post') to access post data
+
+
+
Bug Tracker
+
Bugs are tracked on GitHub Issues.
+In case of trouble, please check there if your issue has already been reported.
+If you spotted it first, help us to smash it by providing a detailed and welcomed
+feedback.
+
Do not contact contributors directly about support or help with technical issues.
+
+
+
Credits
+
+
+
+
+
+
Maintainers
+
This module is maintained by the OCA.
+
+
+
+
OCA, or the Odoo Community Association, is a nonprofit organization whose
+mission is to support the collaborative development of Odoo features and
+promote its widespread use.
+
Current maintainer:
+

+
This module is part of the OCA/website project on GitHub.
+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
+
+
+
+
diff --git a/website_blog_email_template/tests/__init__.py b/website_blog_email_template/tests/__init__.py
new file mode 100644
index 0000000000..622bb44ec9
--- /dev/null
+++ b/website_blog_email_template/tests/__init__.py
@@ -0,0 +1 @@
+from . import test_website_blog_email_template
diff --git a/website_blog_email_template/tests/test_website_blog_email_template.py b/website_blog_email_template/tests/test_website_blog_email_template.py
new file mode 100644
index 0000000000..2062109297
--- /dev/null
+++ b/website_blog_email_template/tests/test_website_blog_email_template.py
@@ -0,0 +1,273 @@
+# Copyright 2025 Marcel Savegnago - Escodoo