I need to change the order of the 'span' objects before the text in the elements 'a' using Jquery.
someone can help me?
<a href="#" class="has-submenu">
Some text content
<span class="dropdown-menu-toggle"></span>
<span class="sub-arrow"> > </span>
</a>
must to be :
<a href="#" class="has-submenu">
<span class="dropdown-menu-toggle"></span>
<span class="sub-arrow"> > </span>
Some text content <-(This text must to be in the end)
</a>
Use the .prependTo() method to move elements to the beginning of a container element.
$("#move").click(function() {
$(".has-submenu span").prependTo($(".has-submenu"));
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<a href="#" class="has-submenu">
Some text content
<span class="dropdown-menu-toggle">toggle</span>
<span class="sub-arrow"> > </span>
</a>
<br>
<button id="move">Move spans</button>
I am trying to utilize Microdata to help search engines define all the content of my website as it is intended to be viewed.
I have the following markup:
<!DOCTYPE html>
<html lang="en" dir="ltr" itemscope itemtype="http://schema.org/WebPage">
<head>
<link itemprop="url" href="https://example.com/link-to-canonical-url-of-this-page" />
</head>
<body>
<div itemprop="isPartOf" itemscope itemtype="https://schema.org/WebSite">
<link itemprop="url" href="https://example.com" />
</div>
<header itemscope itemtype="https://schema.org/WPHeader">
<ul class="list-unstyled mb-0 pb-0 mt-2" itemprop="citation" itemscope="" itemtype="http://www.schema.org/SiteNavigationElement">
<li>
<a title="" itemprop="url" href="/some-uri" class="btn btn-link text-white" style="font-size: larger;">
<strong itemprop="name">Popular Searches</strong>
</a>
<meta itemprop="position" content="1">
</li>
</ul>
</header>
<main role="main">
</main>
<footer itemscope itemtype="https://schema.org/WPFooter">
<ul class="list-unstyled mb-0 pb-0 mt-2" itemprop="citation" itemscope="" itemtype="http://www.schema.org/SiteNavigationElement">
<li>
<a title="" itemprop="url" href="/some-uri" class="btn btn-link text-white" style="font-size: larger;">
<strong itemprop="name">Popular Searches</strong>
</a>
<meta itemprop="position" content="1">
</li>
</ul>
</footer>
</body>
</html>
But when I view the above in Structured Data Testing Tool, it detects everything I intended except for the position of each element.
The tool detects the data as three different nodes. Since all these nodes are part of the WebSite or WebPage, I am hoping to somehow link the header and footer inside the WebPage node.
How can I indicate that the WPHeader and WPFooter are part of the WebPage node?
Update
I found a way to combine all 3 nodes into the main WebPage. However, I used multiple mainContentOfPage or mainEntity to do it. I am not sure if having mainContentOfPage is the correct way to do it. It kinds contradict the name as there should always be a main-content of a single page.
Here is the updated HTML markup:
<!DOCTYPE html>
<html lang="en" dir="ltr" itemscope itemtype="http://schema.org/WebPage">
<head>
<link itemprop="url" href="https://example.com/link-to-canonical-url-of-this-page" />
</head>
<body itemprop="mainContentOfPage">
<div itemprop="isPartOf" itemscope itemtype="https://schema.org/WebSite">
<link itemprop="url" href="https://example.com" />
</div>
<header itemprop="mainContentOfPage" itemscope itemtype="https://schema.org/WPHeader">
<ul class="list-unstyled mb-0 pb-0 mt-2" itemprop="mainEntity" itemscope="" itemtype="http://www.schema.org/SiteNavigationElement">
<li>
<a title="" itemprop="url" href="/some-uri" class="btn btn-link text-white" style="font-size: larger;">
<strong itemprop="name">Popular Searches</strong>
</a>
<meta itemprop="position" content="1">
</li>
</ul>
</header>
<main role="main">
</main>
<footer itemprop="mainContentOfPage" itemscope itemtype="https://schema.org/WPFooter">
<ul class="list-unstyled mb-0 pb-0 mt-2" itemprop="mainEntity" itemscope="" itemtype="http://www.schema.org/SiteNavigationElement">
<li>
<a title="" itemprop="url" href="/some-uri" class="btn btn-link text-white" style="font-size: larger;">
<strong itemprop="name">Popular Searches</strong>
</a>
<meta itemprop="position" content="1">
</li>
</ul>
</footer>
</body>
</html>
You can use the hasPart property.
<html itemscope itemtype="http://schema.org/WebPage">
<div itemprop="isPartOf" itemscope itemtype="http://schema.org/WebSite">
</div>
<header itemprop="hasPart" itemscope itemtype="http://schema.org/WPHeader">
<nav itemprop="hasPart" itemscope itemtype="http://schema.org/SiteNavigationElement">
</nav>
</header>
<main>
<article itemprop="mainEntity" itemscope itemtype="http://schema.org/CreativeWork">
</article>
</main>
<footer itemprop="hasPart" itemscope itemtype="http://schema.org/WPFooter">
<ul itemprop="hasPart" itemscope itemtype="http://schema.org/SiteNavigationElement">
</ul>
</footer>
</html>
On researching how to do microdata for webpage breadcrumbs, I've found a couple of methods and I'm not sure which is correct. Firstly, my basic breadcrumbs in the HTML look like this:
<div>
Root page
Category page
This page
</div>
Now, do I structure it like this (as I've seen in an example on SchemaOrg:
<ol itemscope itemtype="http://schema.org/BreadcrumbList">
<li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
<a href="/" itemprop="item">
<span itemprop="name">Root page</span>
</a>
</li>
<li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
<a href="/category" itemprop="item">
<span itemprop="name">Category page</span>
</a>
</li>
<li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
<a href="/category/this-page" itemprop="item">
<span itemprop="name">This page</span>
</a>
</li>
</ol>
Or do I structure it like the below as I've seen in some Stackoverflow answers:
<div>
<span itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
<a href="/" itemprop="url">
<span itemprop="title">Root page</span>
</a>
</span>
<span itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
<a href="/category" itemprop="url">
<span itemprop="title">Category page</span>
</a>
</span>
<span itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
<a href="/category/this-page" itemprop="url">
<span itemprop="title">This page</span>
</a>
</span>
</div>
Or a different method I don't know about yet??
Modern (2019) correct breadcrumbs Microdata markup is like provided below.
And if you want to complain best practices do not make the last breadcrumb item as a link on your page - you can use <span> instead of <a> in a such manner:
<ol itemscope itemtype="http://schema.org/BreadcrumbList">
<li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
<a itemscope itemtype="http://schema.org/Thing" itemprop="item" href="/" itemid="/">
<span itemprop="name">Root page</span>
</a>
<meta itemprop="position" content="1" />
</li>
<li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
<a itemscope itemtype="http://schema.org/Thing" itemprop="item" href="/category" itemid="/category">
<span itemprop="name">Category page</span>
</a>
<meta itemprop="position" content="2" />
</li>
<li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
<span itemscope itemtype="http://schema.org/Thing" itemprop="item" itemid="/category/this-page">
<span itemprop="name">This page</span>
</span>
<meta itemprop="position" content="3" />
</li>
</ol>
This code is fully compliant to BreadcrumbList (see also that item's id is required) and passes Google validation on https://search.google.com/structured-data/testing-tool excellent.
I would do something like :
<div itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
<span itemprop="title">Homepage</span>
<div itemprop="child" itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
<span itemprop="title">Child-A</span>
</div>
<div itemprop="child" itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
<span itemprop="title">Child-B</span>
</div>
</div>
Tested on : https://search.google.com/structured-data/testing-tool
Use Schema.org as data-vocabulary.org is abandoned.
There were a few markups when the idea came up. But since then the standard has arrised as being Schema.org. It's of course supported by Google and given in its examples (one is BreadCrumbs).
The second is not part of schema.org, it uses a different vocabulary from data-vocabulary so I can't comment on if it works. The first is microdata using schema.org, which is the type given in google's breadcrumb examples.
Only structured data including Schema.org links uses schema.org - but you can use <div> and <span> with Schema.org if you want to. Structured data gives the meaning of the page and should for the most part be independent to how it appears visually, meaning that it doesn't matter whether you use bullet points or <div>s for your breadcrumbs, the structured data will work in the same way for both and have the same meaning.
It might be a subjective decision to be made. I would prefer Microdata method from Google as shown at https://developers.google.com/structured-data/breadcrumbs which follows ol/li method.
As long as you mention itemscope, itemptype and itemprop properly, it should't matter much which method you use.
you need to use "name" not "title", read all about it on in the docs: https://developers.google.com/search/docs/data-types/breadcrumbs
<ol itemscope itemtype="http://schema.org/BreadcrumbList">
<li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
<a itemtype="http://schema.org/Thing" itemprop="item" class="" href="https://exampe.com/">
<span itemprop="name">Root page</span></a>
<meta itemprop="position" content="1">
</li>
<li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
<a itemtype="http://schema.org/Thing" itemprop="item" class="" href="https://exampe.com/category">
<span itemprop="name">Category page</span></a>
<meta itemprop="position" content="2">
</li>
<li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
<a itemtype="http://schema.org/Thing" itemprop="item" class="" href="https://exampe.com/category/this-page">
<span itemprop="name">This page</span></a>
<meta itemprop="position" content="3">
</li>
</ol>
To fix Fix Breadcrumbs markup in Google Search Console about missing field "id" , I just removed property itemscope from anchor
from
<a itemscope itemtype="http://schema.org/Thing" itemprop="item" href="..">link</a>
to
<a itemtype="http://schema.org/Thing" itemprop="item" href="..">
and it worked. I tested and checked this on 2 websites that I got that error.
I'm new to bootstrap and trying to style the breadcrumb. I tried this and it gives me the proper inline layout I want.
<div class="BreadCrumbs">
<a href="www.yahoo.com" >Yahoo</a>
<span class="divider" > > </span>
<a href="www.example.com" >Example</a>
<span class="divider" > > </span> Google
</div>
But I want to add schema data and still maintain the proper styling. So I tried this but all the links are in different lines. How do I get them to be inline in one single line?
<div class = "BreadCrumbs" itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
<a href="www.yahoo.com" itemprop="url">
<span itemprop="title">Yahoo</span>
</a> ›
</div>
<div class = "BreadCrumbs" itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
<a href="www.example.com" itemprop="url">
<span itemprop="title">Example</span>
</a> ›
</div>
<div class = "BreadCrumbs" itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
<a href="www.google.com" itemprop="url">
<span itemprop="title">Google</span>
</a>
</div>
From Google: https://developers.google.com/search/docs/data-types/breadcrumbs
Use a list and then style the li elements inline
.breadcrumbs li {
display: inline;
}
<div class="breadcrumbs">
<ol itemscope itemtype="http://schema.org/BreadcrumbList">
<li itemprop="itemListElement" itemscope
itemtype="http://schema.org/ListItem">
<a itemscope itemtype="http://schema.org/Thing"
itemprop="item" href="https://example.com/books">
<span itemprop="name">Books</span>
<img itemprop="image" src="http://example.com/images/icon-bookicon.png" alt="Books"/></a>
<meta itemprop="position" content="1" />
</li>
›
<li itemprop="itemListElement" itemscope
itemtype="http://schema.org/ListItem">
<a itemscope itemtype="http://schema.org/Thing"
itemprop="item" href="https://example.com/books/sciencefiction">
<span itemprop="name">Science Fiction</span>
<img itemprop="image" src="http://example.com/images/icon-science-fiction.png" alt="Genre: Science Fiction"/></a>
<meta itemprop="position" content="2" />
</li>
›
<li itemprop="itemListElement" itemscope
itemtype="http://schema.org/ListItem">
<a itemscope itemtype="http://schema.org/Thing"
itemprop="item" href="https://example.com/books/sciencefiction/ancillaryjustice">
<span itemprop="name">Ancillary Justice</span>
<img itemprop="image" src="http://example.com/images/cover-ancillary-justice.png" alt="Ancillary Justice"/></a>
<meta itemprop="position" content="3" />
</li>
</ol>
</div>
I have a seemingly simple alignment issue I can't seem to fix. I have a basic menu inside a div. I want to add content underneath the menu, so I created another div with a top-margin of 10px. For some reason, it is not recognizing the content as separate and keeps inserting the content in line with the menu. The information span class is being placed on the same level as the menu. Please let me know if you see a problem with the way these divisions are set up!
The CSS code just has a padding of 10px on the top for the information class.
HTML CODE:
<body>
<div class="content">
<h1 class="title">HOME PAGE</h1>
<img src="pic.jpg" alt="Picture" style="padding:0px 0px 0px 45px"/>
<ul id="sdt_menu" class="sdt_menu">
<li>
<a href="#">
<img src="images/1.jpg" alt=""/>
<span class="sdt_active"></span>
<span class="sdt_wrap">
<span class="sdt_link">EXAMPLE</span>
<span class="sdt_descr">EXAMPLE</span>
</span>
</a>
</li>
<li>
<a href="#">
<img src="images/1.jpg" alt=""/>
<span class="sdt_active"></span>
<span class="sdt_wrap">
<span class="sdt_link">EXAMPLE</span>
<span class="sdt_descr"></span>
</span>
</a>
<div class="sdt_box">
EXAMPLE
</div>
</li>
<li>
<a href="#">
<img src="images/1.jpg" alt=""/>
<span class="sdt_active"></span>
<span class="sdt_wrap">
<span class="sdt_link">EXAMPLE</span>
</span>
</a>
</li>
<li>
<a href="#">
<img src="images/1.jpg" alt=""/>
<span class="sdt_active"></span>
<span class="sdt_wrap">
<span class="sdt_link">EXAMPLE</span>
</span>
</a>
<div class="sdt_box">
EXAMPLE
</div>
</li>
<li>
<a href="#">
<img src="images/1.jpg" alt=""/>
<span class="sdt_active"></span>
<span class="sdt_wrap">
<span class="sdt_link">EXAMPLE</span>
</span>
</a>
</li>
<li>
<a href="#">
<img src="images/1.jpg" alt=""/>
<span class="sdt_active"></span>
<span class="sdt_wrap">
<span class="sdt_link">EXAMPLE</span>
<span class="sdt_descr"></span>
</span>
</a>
<div class="sdt_box">
A
</div>
</li>
</ul>
</div>
<div>
<span class="information">
<p>
Some content here
</p>
</span>
</div>
With out seeing your CSS it sounds like a float issue. You need to clear floated elements. Assuming you did them correctly they're most likely on the li tags. You can use overflow:hidden on your parent ul:
ul#sdt_menu{
overflow: hidden;
}
or you can use a cleafix method
ul#sdt_menu:after{
content: '';
display: block;
clear: both;
}
If neither of these work please post your CSS for further help