What could cause the Twitter card validator to give a redirect loop error? - twitter

I'm using https://cards-dev.twitter.com/validator on http://parlaywith.me.
When I include this tag (currently included):
<meta property="og:url"
content="http://parlaywith.me">
I get this error:
When I remove the tag, I get:
How can I keep the og:url tag and avoid the error?

You might have to specify the URL with the trailing slash:
http://parlaywith.me/
instead of
http://parlaywith.me
Also note that HTML5 requires to use link (instead of meta) if the value is a URI:
<link property="og:url"
href="http://parlaywith.me/">

Related

Thymeleaf - Set attribute in meta tag with conditional

I would like to set the content of my "robots" tag depending on an attribute returned with my model. In my back end return statements, I have one place where I return the following snippet, and some places where I do not set that attribute at all.
model.addAttribute("robotsMetaTag", "all");
return "pages/index";
I would like to make it so the attribute looks like this if I am setting robotsMetaTag:
<meta name="robots" content="all"/>
and like this if there robotsMetaTag is not set:
<meta name="robots" content="none"/>
Currently, I am doing the following:
<meta name="robots" th:attr="content=${robotsMetaTag}"/>
This works for the pages where I am returning a value for robotsMetaTag, but I would like a default case where if nothing is set/returned then I want the default to be "none". I've been trying to get th:attrappend to work for me for this, but I'm getting parsing errors with the following:
<meta name="robots" th:attrappend="content=${${robotsMetaTag} == null}?none:${robotsMetaTag}"/>
Any help would be greatly appreciated.
Try out this
<meta name="robots" th:attr="content=${robotsMetaTag==null?'none':robotsMetaTag}"/>
Since th:content is a supported attribute and Thymeleaf supports the the elvis operator, you can simplify your expression to this and achive the same result:
<meta name="robots" th:content="${robotsMetaTag} ?: 'none'" />
I figured it out... I was playing too fast and loose with my curly bois... This is what I was looking for. It adds a default case if "robotsMetaTag" is not set.
<meta name="robots" th:attrappend="content=${robotsMetaTag == null} ? none : ${robotsMetaTag}"/>

HAML: How do I generate a self-closing (href-lang) link tag?

I need to generate this exact (href-lang) link HAML:
<link rel="alternate" hreflang="es" href="http://es.example.com/" />
This HAML code:
%link{href: "http://es.example.com/", hreflang: "es", rel: "alternate"}
gets converted to:
<link href="http://es.example.com/" hreflang="es" rel="alternate"></link>
Any ideas anyone?
Can you post what version of HAML you are running? Also make sure that your list of auto closed tags has not been altered.
I would also double check that your link tags are not just HTML5 "assumed closed" w/ no trailing / at the end of the tag.
https://github.com/haml/haml/blob/master/REFERENCE.md#empty-void-tags-

Unable to decode a URL string encoded by MVC

I'm passing a string with a URL from the controller to the view (using a model).
While the string is in the controller, it is not encoded, but in the view the URL is encoded.
URL before encoding:
http://app.xpinator.com/FacebookPayments/FacebookDesktopAdData?paymentCode=s5usd920k&userLocale=en-us&ver=v3.0.1
URL after encoding:
http://localhost/FacebookPayments/FacebookPaymentItemData?paymentcode=v250usd45000k&userlocale=en-us&ver=v3.0.1
Relevant line in the view:
<meta property="og:url" content="#Model.URL" />
I want to display a decoded URL in the view. I tried using HttpUtility.HtmlDecode, HttpUtility.UrlDecode and Html.Raw - nothing worked.
Any ideas?
EDIT:
Thanks to Daniel's comment I realized that the encoding is happening only when the URL is in a meta property. when its a "displayable" HTML there is no encoding.
Anyway, still looking for a solution.
After realizing the problem occurs only with meta tags, I've found this thread:
Why is Html.Raw escaping ampersand in anchor tag in ASP.NET MVC 4?
I managed solve the problem with the suggested workaround to make the entire meta tag part of the raw value.
like this:
Controller:
model.URL = string.Format("{0}{1}{2}", "<meta property=\"og:url\" content=\"", paymentItemOG.URL, "\" />");
View:
<meta property="og:image" content="#Model.Image" />
#Html.Raw(Model.URL)
<meta property="og:description" content="#Model.Description" />
Page view-source:
<meta property="og:image" content="http://localhost/content/images/75x75_fullLogo.png" />
<meta property="og:url" content="http://localhost/FacebookPayments/FacebookPaymentItemData?paymentcode=v250usd45000k&userlocale=en-us&ver=v3.0.1" />
<meta property="og:description" content="texttexttext" />
Now it works great.

unable to share url with image in google+ in ios app

I am working on an app in which I am trying to share an image with a url via google+. I am using GPPNativeShareBuilder for the same. But its not sharing anything and giving following warning "You cannot attach a link and media to a post at the same time."
Same is mentioned in method description on google forum as
(id) attachImage: (UIImage *) imageAttachment
If there is an existing media attachment, it is replaced. If imageAttachment is nil, this method does nothing and returns nil. This method cannot be called in combination with either setURLToShare: or setTitle:description:thumbnailURL:.
Please suggest me any solution to resolve this problem.
We can not allowed to add image and link same time in the post,
But we can add "meta" in link, Have to add "meta" in the header of the Link page,
And define image in this "meta".
Google use Open Graph (og) meta as Facebook, Here is the sample meta,
<meta property="og:site_name" content="Your Site Name" />
<meta property="og:title" content="Title of the Post" />
<meta property="og:description" content="Description for the post" />
<meta property="og:url" content="URL where you want to redirect on web" />
<meta property="og:image" content="Your image URL" />
Here is the Some Sample site that is good example
http://moz.com/blog/meta-data-templates-123
http://www.bruceclay.com/blog/how-to-use-social-meta-tags/

Facebook Open Graph - LIKE is not displayed in the News Feed

I have the LIKE button in the website, but URL like https://www.website.com/something/1/something2/2 is not displayed in the News Feed on Facebook.
Here's my setup:
<html xmlns:fb='http://www.facebook.com/2008/fbml' xmlns:og='http://opengraphprotocol.org/schema/'>
<meta content='New Listingggg' property='og:title'>
<meta content='article' property='og:type'>
<meta content='https://www.filepicker.io/api/file/1234567890' property='og:image'>
<meta content='https://website.herokuapp.com/something1/1/something2/2' property='og:url'>
<meta content='Website name' property='og:site_name'>
<meta content='New record' property='og:description'>
<meta content='147949055123456' property='fb:app_id'>
<link href='https://www.filepicker.io/api/file/1234567890' rel='image_src'>
<meta content='http://cache.thisorth.at/blog-images/00000/00000/161.jpg' name='image'>
<link href='https://website.herokuapp.com/something1/1/something2/2' rel='canonical'>
<meta content='en_US' property='og:locale'>
When I check this URL on the Facebook tool, I see there following:
Critical Errors That Must Be Fixed - Bad Response Code: URL returned a bad HTTP response code.
Errors That Must Be Fixed - Missing Required Property: The 'og:type' property is required, but not present.
Open Graph Warnings That Should Be Fixed
Inferred Property: The 'og:url' property should be explicitly provided, even if a value can be inferred from other tags.
Inferred Property: The 'og:title' property should be explicitly provided, even if a value can be inferred from other tags.
I am fighting with this issue the second day and it drives me crazy, what am I missing?
The all tags that are mentioned that I am missing them are implemented in the website, thus... where could be the problem?
Thanks a lot!
EDIT:
Updated HTML output.
EDIT2:
Output from console:
Blocked a frame with origin "https://www.facebook.com" from accessing a frame with origin "https://website.herokuapp.com". The frame requesting access set "document.domain" to "facebook.com", but the frame being accessed did not. Both must set "document.domain" to the same value to allow access. like.php?api_key=439601822731111&locale=cs_CZ&sdk=joey&channel_url=http%3A%…scheme=light&show_faces=false&send=false&extended_social_context=false:403

Resources