I am using Ruby on Rails to generate the email. As mentioned in the Email markup docs, i modified my (*.html.haml) templates to include the schema for Email markup. Below code is from my mailer template:
%script{ type: "application/ld+json" }
{
"@context" : "http://schema.org",
"@type" : "FoodEstablishmentReservation",
"reservationNumber" : "#{reservation.id}",
...
}
I also modified the sender and receiver of the email to the same email id as mentioned here for testing the schema in development mode.
When i receive the email in my Gmail inbox, and i don't see anything different from before. When i check the Original Message of the email, it shows:
Return-Path: <breezebhoewal@gmail.com>
...
Date: Wed, 21 Dec 2016 13:14:45 +0530
From: breezebhoewal@gmail.com
To: breezebhoewal@gmail.com
...
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="--==_mimepart_585a32ecf2d94_143673fd10d24128893014"; charset=UTF-8
Content-Transfer-Encoding: 7bit
----==_mimepart_585a32ecf2d94_143673fd10d24128893014
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
...
<script type=3D'application/ld+json'>
{
"@context" : "http://schema.org",
"@type" : "FoodEstablishmentReservation",
"reservationNumber" : "<reservation-id>",
...
}
</script>
...
Now, if i validate this <script>
tag content in the Email markup tester, it says "no structured data is present", but as soon as i remove "3D" from <script>
tag and make it <script type='application/ld+json'>
, it extracts the structured data correctly for all the fields.
So, i am unable to figure out why this extra string "3D" is being added to the HTML? Is it because of Haml? or Gmail does it? AND is there anything i can fix to test this Email markup in development environment. Let me know if more info is needed.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…