I have this markup for Dentist https://schema.org/Dentist
<div itemscope itemtype="http://schema.org/Dentist">
// address is ok
<span itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
<span itemprop="streetAddress">asdfd sf412</span>
<span itemprop="postalCode">12345</span>
<span itemprop="addressLocality">sadfsdf</span>
</span>
// this fails
<span itemprop="logo" itemscope itemtype="http://schema.org/ImageObject">
<meta itemprop="url" content="logo.gif'; ?>" />
</span>
</div>
When trying to test code for itemprop="logo" https://schema.org/logo
Google testing gives me error: "A value for the url field is required."
What am I missing?
I don't want logo to be visible on page, thats why I have put it as meta.
The error in Google’s SDTT is about the Dentist item, not about the ImageObject item. You can see this from the nesting level, the url row is on the same level as logo and address.
So adding a url property to the Dentist item would get rid of the error.
<div itemscope itemtype="http://schema.org/Dentist">
<span itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
<span itemprop="streetAddress">asdfd sf412</span>
<span itemprop="postalCode">12345</span>
<span itemprop="addressLocality">sadfsdf</span>
</span>
<span itemprop="logo" itemscope itemtype="http://schema.org/ImageObject">
<link itemprop="url" href="logo.gif" />
</span>
<link itemprop="url" href="http://example.com/" />
</div>
I changed the meta to link, because HTML5 and Microdata require that you use link (instead of meta) if the value is a URI.
Just in case if you are looking for a JSON-LD format, look over the below code and give it a shot.
"publisher": {
"#type": "Organization",
"name": "Lokaci",
"url": "https://lokaci.com",
"logo": {
"#type": "ImageObject",
"url": "https://res.cloudinary.com/lokaci/image/upload/v1580448186/logo/lokaci_logo_black-corp-comp_nzkooj.png"
}
},
Here is the full code if you wanna have a look, the schema micro-data was about a news article.
------------------full JSON-LD format below ----------------
{
"#context": "https://schema.org",
"#type": "NewsArticle",
"url": "https://lokaci.com/news/Diwali-Countdown-Offer-A-Brothers-Gift",
"publisher": {
"#type": "Organization",
"name": "Lokaci",
"url": "https://lokaci.com",
"logo": {
"#type": "ImageObject",
"url": "https://res.cloudinary.com/lokaci/image/upload/v1580448186/logo/lokaci_logo_black-corp-comp_nzkooj.png"
}
},
"dateline": "Laxminagar Delhi, 26 October 2019",
"headline": "Diwali Countdown Offer: A Brother’s Gift",
"mainEntityOfPage": "https://lokaci.com/newsroom",
"author": {
"#type": "Organization",
"name": "Lokaci",
"logo": "https://res.cloudinary.com/lokaci/image/upload/v1580448186/logo/lokaci_logo_black-corp-comp_nzkooj.png"
},
"image": "https://res.cloudinary.com/lokaci/image/upload/v1575284148/Newsroom/A-One-Salon-Lokaci-wins-Oppo-phone_dfvzdl.jpg",
"datePublished": " 26 October 2019",
"dateModified": " 26 October 2019",
"wordCount": 165,
"keywords": "Lokaci, News"
}
Related
I try to implement a JSON-LD breadcrumb for a web site with the following structure:
Home
Topic A (No content)
Article A1
Article A2
Topic B (No content)
Article B1
Article B2
Topic C (No content)
Article C1
Article C2
My problem is that all pages on level 2 (Topic A/B/C) are empty pages that can not be reached by the main navigation. People should not navigate to "Topic A" etc.
How can I express this behavior in my JSON-LD breadcrumb?
This is what my JSON-LD looks like for page "Article A1":
{
"#context": "https://schema.org",
"#type": "BreadcrumbList",
"itemListElement": [{
"#type": "ListItem",
"position": 1,
"name": "Home",
"item": "https://example.com/"
},{
"#type": "ListItem",
"position": 2,
"name": "Topic A",
"item": ""
},{
"#type": "ListItem",
"position": 3,
"name": "Article A1",
"item": "https://example.com/topic-a/article-a1"
}]
}
When I try to validate the above code with https://search.google.com/structured-data/testing-tool it always complains:
itemListElement
#type ListItem
position 2
name Topic A
item Field item requires a value.
Specifying anything else than a URL will result in:
Value for field item must be a valid URL.
How can I describe that 2nd level pages are not reachable by a URL using JSON-LD?
The point of breadcrumbs is to see the current page in the hierarchy, and to navigate to its parent pages. Page-less entries shouldn’t appear there, because they can’t be navigated to.
Schema.org’s BreadcrumbList type is only meant for web pages (but such a page-less topic isn’t a web page, of course):
A BreadcrumbList is an ItemList consisting of a chain of linked Web pages, typically described using at least their URL and their name, and typically ending with the current page.
This is also what Google requires for their Breadcrumbs rich result (in case you want to get this feature):
A user can navigate all the way up in the site hierarchy, one level at a time, by starting from the last breadcrumb in the breadcrumb trail.
So, you could either omit the page-less topics in the BreadcrumbList, or make them actual pages.
If you don’t want them to exist as pages, you could still convey what the topic is (see example with about below), but I wouldn’t expect this data to get used by consumers that are interested in your breadcrumbs:
{
"#context": "http://schema.org",
"#type": "BreadcrumbList",
"itemListElement":
[
{
"#type": "ListItem",
"position": 1,
"item":
{
"#id": "https://example.com/",
"#type": "WebPage",
"name": "Home"
}
},
{
"#type": "ListItem",
"position": 2,
"item":
{
"#id": "https://example.com/article-a1",
"#type": "WebPage",
"name": "Article A1",
"about": {
"#type": "Thing",
"name": "Topic A"
}
}
}
]
}
HTML+RDFa:
<ol typeof="schema:BreadcrumbList">
<li property="schema:itemListElement" typeof="schema:ListItem">
<a property="schema:item" typeof="schema:WebPage" href="https://example.com/">
<span property="schema:name">Home</span>
</a>
<meta property="schema:position" content="1" />
</li>
<li property="schema:itemListElement" typeof="schema:ListItem">
<a property="schema:item" typeof="schema:WebPage" href="https://example.com/article-a1">
<span property="schema:name">Article A1</span>
<span property="schema:about" typeof="schema:Thing">
<meta property="schema:name" content="Topic A" />
</span>
</a>
<meta property="schema:position" content="2" />
</li>
</ol>
I am using amp-list with firebase REST api. The thing is when I use
"https://kitchentocustomer.firebaseio.com/restaurants/Yiecu6fL2Pas0XFhCsT06Q0dSOp1/menu.json"
I get the amp-list populated,but when I add query parameters
"https://kitchentocustomer.firebaseio.com/restaurants/Yiecu6fL2Pas0XFhCsT06Q0dSOp1/menu.json?orderBy=%22first_cat%22&equalTo=%22BREAKFAST%22&print=pretty"
I get empty amp-list.
Here is the code
<amp-list width="300"
height="250"
single-item
items="."
layout="responsive"
src="https://kitchentocustomer.firebaseio.com/restaurants/Yiecu6fL2Pas0XFhCsT06Q0dSOp1/menu.json?orderBy=%22first_cat%22&equalTo=%22BREAKFAST%22&print=pretty">
<template type="amp-mustache">
<div>
<dt class="col col-10 h3 mb1">{{title}}</dt>
<dd class="col col-2 m0 mb1 self-center right-align">₹{{price}}</dd>
</div>
</template>
</amp-list>
The amp-list response must be a JSON object containing an array property.
Your filtered query (second link) returns a JSON object which does not contain an array.
Your response for this should be something like below
[
{
"discounted": 157,
"first_cat": "BREAKFAST",
"id": "eEaVn8",
"onSale": false,
"price": 167,
"third_cat": "Egg",
"title": "Egg omlete"
},
{
"discounted": 210,
"first_cat": "BREAKFAST",
"id": "pia9nL",
"onSale": false,
"price": 228,
"third_cat": "Waffles",
"title": "Banana & Nutella waffles"
}
]
Screenshot of the issues:
Web3.min.js path in my system directory!
Web3.min.js is loaded from folder in my browser
Copy of the web3.min.js in the same folder where index.html file is present.
Code added
info of the node!
I am facing following two issues:
Failed to load resource: web3.min.js:1 net::ERR_CONNECTION_REFUSED
ERROR: Couldn't connect to node http://localhost:8545.
My Index.html file is
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<link rel="stylesheet" type="text/css" href="main.css">
</head>
<body>
<div class="container">
<h1>Coursetro Instructor</h1>
<h2 id="instructor"></h2>
<label for="name" class="col-lg-2 control-label">Instructor Name</label>
<input id="name" type="text">
<label for="name" class="col-lg-2 control-label">Instructor Age</label>
<input id="age" type="text">
<button id="button">Update Instructor</button>
</div>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script>
<script>
if (typeof web3 !== 'undefined') {
web3 = new Web3(web3.currentProvider);
} else {
// set the provider you want from Web3.providers
web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
}
web3.eth.defaultAccount = web3.eth.accounts[0];
var CoursetroContract = web3.eth.contract([
{
"constant": false,
"inputs": [
{
"name": "_fName",
"type": "string"
},
{
"name": "_age",
"type": "uint256"
}
],
"name": "setInstructor",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "getInstructor",
"outputs": [
{
"name": "",
"type": "string"
},
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
}
]);
var Coursetro=CoursetroContract.at('0x95712aa4ff464e56f76af55da6239a368c459ed4');
console.log(Coursetro);
</script>
</body>
</html>
If you are connecting to a local node:
You have included jquery cdn, similarly include a web3 from the link web3_cdn.
You can download one file from the link and connect the file in your webapp by
<script type="text/javascript" src="web3.min.js"></script>
And make sure when you run the app your metamask is disabled. Metamask injects a web3 object right into your application.
For reference check the other answers link
i have this problem and i solve it .
the solution :
you must create index.html and main.css in folder project, not in node_modules folder.
#app.route('/edit_book/<id>', methods=['POST', 'GET'])
def edit_book_id(id):
books = connexion.db.books
item = books.find_one({'_id': ObjectId(id)})
if request.method == 'GET':
if session['username'] is not None:
return render_template('edit_book.html', username=session['username'], mybooks=item)
books.update_one({"id": id},
{
"$set": {"title": request.form.get('title'),
"author": request.form.get('author'),
"edition": request.form.get('edition'),
"price": request.form.get('price'),
"image": request.files.get('image'),
"date": datetime.datetime.utcnow()
}
})
return 'Updated, success'
The html file:
<form action="" method="POST" enctype=multipart/form-data>
<h2>Title</h2>
<input type="text" name="title" size="60" value="{{mybooks.title}}"><br>
<h2>Author</h2>
<input type="text" name="author" size="60" value="{{mybooks.author}}"><br>
<h2>Edition</h2>
<input type="text" name="edition" size="60" value="{{mybooks.edition}}"><br>
<h2>Price</h2>
<input type="text" name="price" size="60" value="{{mybooks.price}}"><br>
<h2>Upload </h2>
<input type="file" name="image"/><br>
<br>
<input type="submit" value="Submit">
</form>
I use a form to edit a document from the Mongodb database. I can edit the document with the GET method but the problem is with the POST method, I can't update the document. I'm new in Flask.
I think I can't get the fields back after editing.
books.update_one({"_id": ObjectId(id)},
{ "$set": {
"title": request.form.get('title'),
"author": request.form.get('author'),
"edition": request.form.get('edition'),
"price": request.form.get('price'),
"image": request.files.get('image'),
"date": datetime.datetime.utcnow()
}
})
Forgot ObjectId(id)
Here is my markup with rich snippets
<div vocab="http://schema.org" typeof="GovernmentOrganization">
<p>
<span property="logo"><img src="http://www.place.com/image.png" class="logo"/></span>
<span class="h2" property="name">Department Of Stuff And Things</span><br />
<span class="h4" property="department">State Agency</span><br />
http://www.place.com
</p>
<strong>Locations:</strong><br /><br />
<div property="location" typeof="GovernmentOffice">
<p property="location" typeof="PostalAddress">
Main Office<br />
<span property="streetAddress">555 Something Street Apt 2</span><br />
<span property="addressLocality">Jacksonville</span>
<span property="addressRegion">FL</span>
<span property="postalCode">11111</span><br />
<span property="addressCountry">US</span>
</p>
</div>
<strong>Services:</strong><br /><br />
<div property="hasOfferCatalog" typeof="OfferCatalog">
<div property="itemListElement" typeof="GovernmentService">
<p>
<strong><span property="name">Service 1</span></strong><br />
<span property="category">Web Based</span><br />
<span property="description">Get Some stuff and things</span><br />
https://www.place.com/Service1<br />
</p>
</div>
<div property="itemListElement" typeof="GovernmentService">
<p>
<strong><span property="name">Apply For Benefits</span></strong><br />
<span property="category">Phone Based</span><br />
<span property="description">This service helps you apply for the benefits you deserve</span><br />
https://www.place.com/Service1<br />
</p>
</div>
</div>
The structured data testing tool seems to organize and validate everything appropriately, Including my small collection of services (OfferCatalog). When doing a request to the Custom Search API and tacking on the :more:pagemap:GovernmentOrganization things seem to be OK and I get results I expect. But the JSON object for pagemap only includes the first level of my organization:
"pagemap": {
"GovernmentOrganization": [
{
"name": "Department Of Stuff And Things",
"department": "State Agency",
"url": "http://www.place.com"
},
Any ideas on why my related objects (GovernmentOffice / locations / OfferCatalog / GovernmentServices) are not being including? Is there a better way to organize and structure this for Google?
Consider this approach. Include the following JSON-LD script in the document. It can go anywhere but consider placing it before the RDFa DIV:
<script type="application/ld+json" id="">
{
"#context":
{
"#vocab": "http://schema.org/",
"#base": "http://www.place.com/"
},
"#graph": [
{
"#id": "_:ub220bL18C41",
"#type": "PostalAddress",
"addressCountry": "US",
"addressLocality": "Jacksonville",
"addressRegion": "FL",
"postalCode": "11111",
"streetAddress": "555 Something Street Apt 2"
},
{
"#id": "_:ub220bL4C1",
"#type": "GovernmentOrganization",
"department": "State Agency",
"hasOfferCatalog": {
"#id": "_:ub220bL6C40"
},
"location": {
"#id": "_:ub220bL17C33"
},
"logo": "",
"name": "Department Of Stuff And Things",
"url": "http://www.place.com"
},
{
"#id": "_:ub220bL17C33",
"#type": "GovernmentOffice",
"location": {
"#id": "_:ub220bL18C41"
}
},
{
"#id": "_:ub220bL6C40",
"#type": "OfferCatalog",
"itemListElement": [
{
"#id": "_:ub220bL12C17"
},
{
"#id": "_:ub220bL7C48"
}
]
},
{
"#id": "_:ub220bL12C17",
"#type": "GovernmentService",
"category": "Web Based",
"description": "Get Some stuff and things",
"name": "Service 1",
"url": "https://www.place.com/Service1"
},
{
"#id": "_:ub220bL7C48",
"#type": "GovernmentService",
"category": "Phone Based",
"description": "This service helps you apply for the benefits you deserve",
"name": "Apply For Benefits",
"url": "https://www.place.com/Service2"
}
]
}
</script>
You'll want to change #base to your site and decide how to organize your directory structure to manage your identifiers. Then change each blank node to the appropriate identifier. Then minimize the JSON-LD.
The JSON-LD is semantically identical to the RDFa. As such, you will be able to analyze the Google pagemap and decide which strategy works better for you. I don't expect Google to penalize the page if the JSON-LD is semantically identical to the HTML/RDFa markup.
As per the Google:
I believe you are seeing only one value of a attribute in JSON API.
I would like to update you that as per the design in JSON API we show only one attribute value, while in XML we show all values.
We already have a feature request #16696973 to display all the attribute values in JSON API. Currently I don't have an ETA when it will be implemented.
As a workaround you have to use XML API.