I am trying to implement Google sitelink on a website. I read Error: Page contains property "query-input" which is not part of the schema and few other articles.
I am using JSON LD format. Here is what it looks like...
[{
"#context" : "https://schema.org",
"#type" : "Organization",
"name" : "yrshaikh.com",
"url" : "https://www.yrshaikh.com/",
"logo" : "https://yrshaikh.com/smile.png",
"sameAs" : [
"https://www.facebook.com/yrshaikh",
"https://www.instagram.com/yrshaikh/",
"https://www.pinterest.com/yrshaikhdotcom/",
"https://www.youtube.com/user/yrshaikh",
"https://twitter.com/yrshaikh",
"https://plus.google.com/+yrshaikh",
"https://www.linkedin.com/company/yrshaikh",
"https://en.wikipedia.org/wiki/yrshaikh.com"
]
},
{
"#context":"https://schema.org",
"#type":"WebSite",
"name":"yrshaikh",
"alternateName":"yrshaikh.com",
"url":"https://www.yrshaikh.com/",
"potentialAction":{
"#type":"SearchAction",
"target":"https://www.yrshaikh.com/search.html?text={search_term_string}&pop=1766357",
"query-input":"required name=search_term_string"
}
}]
(pls ignore the domain name, have replaced the actual one with a dummy domain one - yrshaikh.com)
I do not have any <form> tag on my homepage.
When I search for my domain on Google I do see a Sitelinks Searchbox, but when I enter a search term and search, it does not redirect to my target url with the search term, instead it searches in Google by whatever-search-term site:yrshaikh.com.
I have also tested my JSON LD on Google's Structured Data Testing Tool and it looks good to me, no errors/warnings.
Also another point worth noting is that this search url is internally redirected to a different route based on the incoming keyword.
Please advice.
With an array of objects. Seems like the way to go forward can be this
(i.e. using #graph instead of a normal json array):
Can you try and check for your website?
source references: https://webmasters.stackexchange.com/a/90319, https://stackoverflow.com/a/33457312/1670511
<script type="application/ld+json">
{
"#context": "http://schema.org",
"#graph":
[
{
"#type": "WebSite"
},
{
"#type": "Organization"
}
]
}
</script>
Related
Will this structure be problematic?
<script type="application/ld+json">
{
"#context":"http://schema.org",
"#type":"WebPage",
"name":"Postcards",
"url":"https://local.mysite.com/postcards.html",
"breadcrumb":{
"#type":"BreadcrumbList",
"itemListElement":[
{
"#type":"ListItem",
"position":1,
"item":{
"#id":"https://local.mysite.com",
"name":"My Site"
}
},
{
"#type":"ListItem",
"position":2,
"item":{
"#id":"https://local.mysite.com/postcards.html",
"name":"Postcards"
}
}
]
},
"mainEntity":{
"#type":"WebPageElement",
"offers":{
"#type":"Offer",
"itemOffered":[
{
"#type":"Product",
"name":"Christmas Postcards",
"url":"https://local.mysite.com/christmas-postcards.html"
},
{
"#type":"Product",
"name":"Getaway Postcards",
"url":"https://local.mysite.com/getaway-postcards.html"
}
]
}
}
}</script>
<script type="application/ld+json">
{
"#context":"http://schema.org",
"#type":"WebPage",
"name":"Postcards",
"url":"https://local.mysite.com/postcards.html",
"breadcrumb":{
"#type":"BreadcrumbList",
"itemListElement":[
{
"#type":"ListItem",
"position":1,
"item":{
"#id":"https://local.mysite.com",
"name":"My Site"
}
},
{
"#type":"ListItem",
"position":2,
"item":{
"#id":"https://local.mysite.com/postcards.html",
"name":"Postcards"
}
}
]
},
"mainEntity":{
"#type":"WebPageElement",
"offers":{
"#type":"Offer",
"itemOffered":[
{
"#type":"Product",
"name":"Mini Postcards",
"url":"https://local.mysite.com/mini-postcards.html"
},
{
"#type":"Product",
"name":"Summer Postcards",
"url":"https://local.mysite.com/summer-postcards.html"
}
]
}
}
}</script>
The reason there could be "duplicate" markup like this for a single category page is that the page may use multiple product templates.
In the current implementation, the markup is dynamically constructed in the product template. For example, if there are two product templates for a single Category Page, the markup will be reconstructed twice, but containing different WebPageElement.
Will this yield bad results? I checked in Google's testing tool and it didn't give me any errors or warnings.
Multiple nodes, same entity
If you have multiple nodes that represent the same entity on a page, the best practice is to give these nodes the same URI as identifier.
With JSON-LD, you can provide identifiers with #id.
So
both of your WebPage items could get "#id": "" (for the current URL; preferably specify your canonical URL here),
both of your BreadcrumbList items could get "#id": "#breadcrumbs",
both of your ListItem-1 items could get "#id": "#breadcrumbs-1", and
both of your ListItem-2 items could get "#id": "#breadcrumbs-2".
That way, Google’s SDTT will display each of these items only once, because it now knows that they are about the same entity.
Referencing nodes instead of duplicating them
#id also allows you to reference nodes instead of embedding them (and thereby duplicating their data). See an example.
In your case this would have the advantage that you don’t have to duplicate the WebPage/BreadcrumbList/ListItem nodes to begin with. You would specify these nodes once, and each product template would then outpout only the Offer/Product nodes. These nodes could include (reverse) references to the WebPage/etc. (might be easier for you to implement), or the WebPage/etc. could reference these nodes.
I want to add AccountName custom tag defined in docusign on my document through REST API call in Apex. Here is my REST API request body
{
"status" : "sent",
"customFields" : {
"textCustomFields" : [ {
"name" : "AccountName",
"show" : "true",
"required" : "False",
"value" : "Test Account",
"customFieldType" : "text"
} ]
}
}
The URL is https://demo.docusign.net/restapi/v2/accounts/'accountId'/envelopes
I use anchor string /txtAccountName1/ which I have added on my document but it does not map to any value of the custom field AccountName related to salesforce object. For the tabs it works fine it successfully maps the signer tag to s1 and date to the d1 but for this custom field it does not map the AccountName custom tag to the anchor string /txtAccountName1/. I have created the custom tag AccountName related to salesforce object and used anchor string as /txtAccountName{r}/. I am writing the code in sandbox and using Docusign Demo Account for the integration.I am not sure about the name used in textCustomField and value I used is the reason for not getting the required result. Though the Rest API request is returning the sucess.
How can I map the AccountName value to the anchorString defined in my document?
You are mixing two things customtab and customfields. CustomFields is the metadata on an envelope, there is no tab for this and you can send text type of list type custom fields, these type of fields are not visible to a signer/recipient and is sent as metadata in an envelope, For details related to CustomFields are available at https://docs.docusign.com/esign/restapi/Envelopes/EnvelopeCustomFields/create/
Now customTab, if you have already defined an account level customTab as "AccountName" then you can add them using REST API using below call like:
{
"textTabs": [{
"tabLabel": "AccountName",
"documentId": "83644555",
"recipientId": "84066562",
"pageNumber": 1,
"value": "AccountName",
"anchorString": "/txtAccountName1/"
}]
}
So before using the Accountlevel custom tab, you need to create it in your DocuSign account from webapp or using API - https://docs.docusign.com/esign/restapi/CustomTabs/CustomTabs/create/, Once it is created then only you can use it in an envelope.
As far as I can tell, you can't pull in the custom tag definition. You need to define the entire tag every time you use it, which means you'll need to use something like this:
"textCustomFields" : [ {
"name" : "AccountName",
"show" : "true",
"required" : "False",
"value" : "Test Account",
"anchorString": "/txtAccountName1/"
"customFieldType" : "text"
} ]
I’m implementing Schema.org + JSON-LD for my site and trying to add the following in all pages of the site:
<script type="application/ld+json">
{
"#context": "http://schema.org",
"#type": "WebSite",
"url": "http://example.com/",
"potentialAction": {
"#type": "SearchAction",
"target": "http://example.com/search?&q={query}",
"query-input": "required",
"valueName":""
}
}
</script>
I tried to provide multiple values for valueName, but still Google Structured Data Testing Tool reports this as an error.
What is a valid value for valueName?
You can either provide a string value for query-input, in which case you have to specify the part of the target value that represents the placeholder ("query" in your case), prefixed by "required name=" (no space characters):
"target": "http://example.com/search?&q={query}",
"query-input": "required name=query",
Or you can provide a PropertyValueSpecification item value for query-input, in which case you can use valueName and valueRequired explicitly:
"target": "http://example.com/search?&q={query}",
"query-input": {
"#type": "PropertyValueSpecification",
"valueName": "query",
"valueRequired": true
}
In Sitelinks Searchbox, Google only documents the first way. The second way is what their testing tool parses when using the first way.
I have setup a content type with a subject field that has pre assigned values in a dropdown field.
I am using the services api to post new content from a polymer app.
When I POST to the api I send the field structure and value in json but get and error.
"406 (Not Acceptable : An illegal choice has been detected. Please contact the site administrator.)"
Even though the object I am sending matches one of the required values in the field.
Do I need to prefix the value with something? I assume I'm posting to the right place to get that response but don't know why it would accept anything other than the string value.
Here is what I sent to the api which is picked up by my Charles proxy.
{
"node": {
"type": "case",
"title": "my case",
"language": "und",
"field_subject": {
"und": {
"0": {
"value": "subject1"
}
}
},
"body": {
"und": {
"0": {
"value": "my details of subject"
}
}
}
}
}
And here is an example of what I have setup in my Drupal field
subject1| first
subject2| second
subject3| third
subject4| forth
For anyone else with the same problem, this subject is poorly documented, but the answer is simple, my subject did not need the value key despite devel suggesting thats how it would be formatted.
"field_subject": {
"und": [
"subject1"
]
}
I could also shorten my code with "und" being an array.
I wanna display the fields names of my records dynamically :
Example:
if i have this three records
{
"_id": {
"$oid": "blahblah"
},
"firstName": "Jon",
"lastName": "Doe",
"age" : "55"
}
{
"_id": {
"$oid": "blahblahblah"
},
"firstName": "Johnny",
"lastName": "Doedoe",
"weight" : "555lb"
}
What i want to display in my web page with angularjs is :
firstname : Jon
lastname : Doe
age : 55
firstname : Johnny
lastname : Doedoe
weight : 555lb
I know how to get specific values, for example to get the firstname i can do this : $scope.person.firstname (this is of course an example), but how can i get the label "firstname". How can i ask angularjs to get all the labels ?
Thanks
You'll have to write a query to your DB to get these records, depending on your server that query will look different. The below is a node version of the call
function getNames() {
db.collection.find().toArray(function(data, err) {
if (err)
//do something
else
res.send(data);
});
}
Now, from Angular, make a GET call to your server:
$http.get(url).success(function(data) {
$scope.names = data;
});
Now you have $scope.names set to your Array of data from the serv. Use an ng-repeat to display it all:
<div ng-repeat="name in names">
<span ng-repeat="(key, val) in name">{{key}}:{{val}}</span>
</div>
And that's it (well, basically, undoubtedly you'll have to tweak this).
Not sure if you're using Express and Jade with Angular, but alternatively if you don't want to make a separate http request (depends on how your app is configured) you could write an angular service that can be reused with any controller.
The purpose of the service would be to grab json and put it into your current scope so your controller can use it. Also you can inject this service dependency on every page (i.e. in every controller) and it'll load your documents for you.
Blog post and full repo here.