Training Paths: Admin

< Back to Article List

061. Email Templates: How to Fix Google Calendar Links

Last updated: 19 November 2025 at 12:08:43 UTC by Administrator

This article explains how to correctly set up Google Calendar links inside your email templates so that the event name, date, and location appear properly when recipients click the Google Calendar button.


Why this?

Google Calendar requires the event date and time to be sent in a specific format.
If the email template does not include these formatted values, Google Calendar cannot read them and instead shows the raw code.


What you need to do

To make sure the Google Calendar button works correctly, two small adjustments must be made in the email template:


Step 1 — Add two lines at the top of the email template

These two lines prepare the event start and end dates in the format Google Calendar needs.

  1. Make sure you are in Debug/Developer mode.

  2. Open the email template

  3. Switch to Code View (the </> icon) (see screenshot).

  4. At the very top, paste the following two lines:

% set date_begin = format_datetime(object.event_id.date_begin, tz='UTC', dt_format="yyyyMMdd'T'HHmmss'Z'")
% set date_end = format_datetime(object.event_id.date_end, tz='UTC', dt_format="yyyyMMdd'T'HHmmss'Z'")


Step 2 — Update the Google Calendar button link

Replace the link on your Google Calendar button with this one:


https://www.google.com/calendar/render?action=TEMPLATE&text=${object.event_id.name}&dates=${date_begin}/${date_end}&location=${location}

This ensures that:

  • Event name appears correctly

  • Start and end time are sent in the right format

  • Location is included if available


Result

After applying these changes:

  • Emails will display normally (no more blank emails).

  • The Google Calendar button will open an event with the correct title, correct dates, and correct location.