Gmail markup metadata dectects wrong dates - google-schemas

I have a problem with the hotel reservation email markup system described in this page
I've included the metadata in an hotel reservation email but it doesn't detect the checkin and checkout dates correctly.
This is the metadata I used.
<div itemscope itemtype="http://schema.org/LodgingReservation">
<meta itemprop="reservationNumber" content="111111">
<link itemprop="reservationStatus" href="http://schema.org/ReservationPending">
<div itemprop="underName" itemscope itemtype="http://schema.org/Person"><meta itemprop="name" content="Guillem Test"></div>
<div itemprop="reservationFor" itemscope itemtype="http://schema.org/LodgingBusiness">
<meta itemprop="name" content="Apartamentos La Solana">
<div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
<meta itemprop="streetAddress" content="-">
<meta itemprop="addressLocality" content="-">
<meta itemprop="addressRegion" content="-">
<meta itemprop="addressCountry" content="-">
<meta itemprop="postalCode" content="-">
</div>
<meta itemprop="telephone" content="-">
</div>
<meta itemprop="checkinDate" content="2021-01-26T16:00:00+00:00">
<meta itemprop="checkoutDate" content="2021-01-27T11:00:00+00:00">
<meta itemprop="bookingTime" content="2020-09-17T00:00:00+00:00">
As you can see, it indicates that check-in and check-out dates are 2021-01-26 and 2021-01-27 respectively, but in gmail, the check-out date detected is 2020-01-28. It always adds one day to the check-out date as you can see in this picture.
It happens with every reservation email I send.
I also tried replacing checkinDate and checkoutDate by checkinTime and checkoutTime as it says here but still doesn't work.
Hope you can help me.
Thank you!

It's likely due to the timezone difference. Try setting your dates to GMT/UTC using Z(ulu): What does the 'Z' mean in Unix timestamp '120314170138Z'?

Related

Open Graph meta tags not accessible, preview of page in Facebook shows "422"?

I can't make my open graph tags accessible to Facebook. When I try to share a page, the site links properly, but the og attributes don't show up, and the title just displays as "422". I'm not sure what this means.
When I run the facebook debugger https://developers.facebook.com/tools/debug/og/object/ I get the following error, which isn't very helpful:
Error parsing input URL, no data was cached, or no data was scraped.
Using the echo feature in the debug tools, all I get is:
Document returned no data
The meta tags appear to be set up properly in my document:
<!DOCTYPE html>
<html>
<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb#">
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="robots" content="noarchive,noodp,noydir" />
<meta name="referrer" content="always" />
<meta property="fb:app_id" content="375576830972731" />
<meta property="og:site_name" content="Site Name" />
<meta property="og:title" content="Title of content" />
<meta property="og:url" content="https://website.domain.com/123456" />
<meta property="og:image" content="http://s3-us-west-1.amazonaws.com/domain/media/images/001/original/001" />
<meta property="og:description" content="Description of content" />
<meta property="og:type" content="article" />
</head>
I made sure to allow for the Facebook crawlers in robots.txt:
User-agent: Facebot
Allow: /
User-agent: facebookexternalhit/1.1
Allow: /
What I am I missing?
The problem here was my protect_from_forgerymethod in application.rb. I added an exception and the Facebot can now see the page.
class StoriesController < ApplicationController
protect_from_forgery except: :show

How to downcase an entire HTML document parsed with Nokogiri

I need to downcase all text in an HTML document that has been parsed with Nokogiri. Here my code:
agent = Mechanize.new
page = agent.get('http://www.example.com').parser.search('//*[translate(text(),"ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz") = *]').to_html
There is not error as such in the code; it executes without an error. If I go in and check a random tag in the document, however, the case is still the same as before. Is there another/better way to downcase all text in a document?
You could use traverse to downcase all text nodes:
require 'open-uri'
require 'nokogiri'
doc = Nokogiri::HTML(open("http://www.example.com/"))
doc.traverse do |node|
node.content = node.content.downcase if node.text?
end
puts doc.to_html
Output:
<!DOCTYPE html>
<html>
<head>
<title>example domain</title>
<meta charset="utf-8">
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type="text/css">
body { ... }
</style>
</head>
<body>
<div>
<h1>example domain</h1>
<p>this domain is established to be used for illustrative examples in documents. you may use this
domain in examples without prior coordination or asking for permission.</p>
<p>more information...</p>
</div>
</body>
</html>

grails header title not working with layout - sitemesh and layout

I have a base header layout (base-header-footer.gsp)
<!DOCTYPE html>
<html>
<head>
<title><g:layoutTitle default="${g.message(code: 'title.index.page')}"/></title>
</head>
... some common resources loading....
<body id="launch">
<g:layoutBody/>
...........................
<r:layoutResources />
</body>
</html>
And then 2 more header, one for logged-in user, and another for guest users, and both of these header layout are extending the base layout.
Guest users (anonymouys-header-footer.gsp) -
<g:applyLayout name="base-header-footer">
<!DOCTYPE html>
<html>
<head>
<g:layoutHead/>
</head>
<body>
... render guest user header
<g:layoutBody/>
</body>
</html>
Logged-in users (loggedin-header-footer.gsp) -
<g:applyLayout name="base-header-footer">
<!DOCTYPE html>
<html>
<head>
... some css
<g:layoutHead/>
</head>
<body>
... Render header for logged-in user
</body>
... load some JS file...
</html>
Now in specific pages I apply guest OR logged-in layout based on user's login state, hence I want to show the page specific title user is on, but it doesn't work.
This is how I am using those layout
OrderStatus.gsp -
<!DOCTYPE html>
<html>
<head>
<title>Order status | Some title</title>
<meta name="layout" content="logged-in-header-footer" />
<script type="text/javascript" src="${resource(dir:'js',file:'some.js')}"></script>
</head>
<body>
</body>
</html>
But I still see the title which is defined base-header-footer.gsp, not the one in OrderStatus.gsp
I have also tried using g:layoutTitle in OrderStatus.gsp but doesn't help.
Any help is highly appreciated.
Use
<meta name="layout" content="base-header-footer">
in your pages to load the layout, then add your title there,
<title>${whatever.something()}</title>
in your layout add this:
<title><g:layoutTitle/></title>
enjoy.
Try to use
<title><g:layoutTitle/></title>
in your layouts (base-header-footer and loggedin-header-footer.gsp). More info in the official documentation.

Facebook OG: Register achivement doesn't work

I'm trying to register facebook open graph achivement, but It doens't work.
Get app access token like this:
https://graph.facebook.com/oauth/access_token?client_id=APP_ID&client_secret=SECRET&grant_type=client_credentials
HTML page look like this:
<html>
<head>
<meta property="og:type" content="game.achievement"/>
<meta property="og:title" content="TITLE"/>
<meta property="og:description" content="DESCRIPTION"/>
<meta property="og:url" content="URL/testAchivement.html"/>
<meta property="og:image" content="URL_TO_IMAGE"/>
<meta property="game:points" content="10"/>
<meta property="fb:app_id" content="APP_ID"/>
<title>ACHIEVEMENT!</title>
</head>
<body>
</body>
</html>
I use this:
https://graph.facebook.com/APP_ID/achievements?achievement=MYSERVER/testAchivement.html&display_order=2&access_token=APP_ACCESS_TOKEN
and get this response:
{
"data": [
]
}
No errors when using facebook debug tool.
Please help , thanks!

Element 'title' occurs too few times, XHTML validation warning in ASP.NET.MVC master page

I am getting the following XHTML validation warning in my ASP.NET MVC master page:
Validation (XHTML 1.0 Transitional): Element 'title' occurs too few times.
The title tag for the master page is included in the ContentPlaceHolder in the head tag as shown in the code below. The title tag in the ContentPlaceHolder is not taken into account when performing the validation, and I do not want to just add another one in the head tag because then I will be left with two title tags.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<asp:ContentPlaceHolder ID="head" runat="server">
<title></title>
</asp:ContentPlaceHolder>
</head>
One work around that I have found is to use the following technique in the head tag:
<% if (false) { %>
<title></title>
<% } %>
Is this the best practice to resolve this warning? I am not a huge fan of adding the excess code just to pass validation warnings but I will live with it if there is not a better alternative.
Do this instead:
<head>
<title><asp:ContentPlaceHolder ID="title" runat="server">Default Page Title Here</asp:ContentPlaceHolder></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<asp:ContentPlaceHolder ID="head" runat="server"></asp:ContentPlaceHolder>
</head>
Or as an alternate, set the title programattically from each page.
What's happening in your case is that when a new view is created, it creates empty content items which override the default content in the placeholders. If you remove the empty content blocks from the view, the default placeholder content will be used, but then you can't set the contents from the view. Using the code above you can override a default title from each view and include scripts, etc. in the head independently of each other.
Here possible solutions are
First solution is
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<asp:ContentPlaceHolder ID="head" runat="server">
//<title></title> - this line should be removed.
</asp:ContentPlaceHolder>
second solution is,
Check whether the head tag having attribute runat="server",if have not set runat prperty means not a problem else need to remove the runat tag.

Resources