Showing posts with label html5. Show all posts
Showing posts with label html5. Show all posts

10/02/2015

Schema: Marking Up the HTML for Improved SEO / Google Search Results

Using Schema Data to Describe Your Web Page


I've been looking for ways to improve a site's SEO. WordPress is the CMS and the theme is bought from a commercial entity. The theme does not include any kind of Schema tags.

Schema.org provides a long list of tag, or rather parameters for your existing HTML5 tags. These schema definitions are used to explain you web page's content even further beyond HTML5's specific tags.

For example, you might want to describe your web page as containing and "Article" or "Event." The latter could be described specifically as a "TheaterEvent", which would then contain specific details like "startDate", "endDate", "duration", and a "review".

Now, I'm trying to extend some of this website's content to include ratings for specific Arts & Entertainment reviews. The ratings are being entered as data using the WordPress plug-in Advanced Custom Fields. All the backend works fine, and data entry is easy, but the ratings are not showing up in Google as I'd hoped. The site's review is listed at the bottom of this image sans 5-Star Rating:



Google sometimes shows 5-Star Ratings on it's listings, which I thought was eye-catching and slightly out of the norm of most results. The first time I set this up, it worked.... I had to wait a couple of days to see if it worked, but the reviews started to show up with Star Ratings just like I'd planned. Then, I thought I'd try out some more of Schema.org's meta info, and that's where I seem to have run into a problem.

Can Schema Data Be Nested?


I don't know. It would seem the answer is yes, but there seems to be a specific formula to the hierarchy, and Schema does not explain how it will be interpreted. Or perhaps I don't understand the purpose of some of the tags.

Google provides a Structured Data Testing Tool here that kind of shows whether you've done it right, but it's not entirely clear if you have or haven't. Obvious errors will show in Red, but here you see it says my attempt is error free. The "Review" and its contained "Rating" are showing at the top inside of the the general "WebPage".



"All good" it says, but it is not doing what I want on Search Results. Here's what I tried:

First, I put a schema wrapper of "WebPage" inside of this page's main <div> tag. 

Then, I wrapped the main content in an "Article" schema.

Then, I tried a couple of different things that had mixed results.
I tried to identify the "Breadcrumbs" on the page. The "Breadcrumbs" were inside the div that described the portion of the "WebPage" as an "Article". So, the "Breadcrumbs" were essentially inside the "Article." Google rejected this -- marked it in red as an error. So, I had to abandon that one.

The other thing I did was to add Schema tags for the "Article" section of "headline", subhead as "alternativeHeadline", "datePublished", "image", and "articleBody". The weird problem with this definitions was that the "image" was a required attribute of "Article". The "Article" was not valid without an "image". Really?!? How strange. This site has opted to always post with an image, but not every news article in the workd has or needs an image. So, kind of stupid to me that it threw an error.

The New Test


Anyhow, the Review is not showing up in the Google Search results with any stars. So, what I'm going to try next is to remove the "WebPage" definition. It doesn't really seem to make any difference. So, we'll see in a couple of days if Google decides that a "Rating" is okay but not an actual nested element of a "WebPage".



On first reload of the Google, it seems to accept the "Review" section, so let's hope this works:


If this works, I don't know what the point of the WebPage definition is. Also, I don't know yet how to define elements of a parent inside of the child. Like I said, putting the "WebPage" "Breadcrumbs" inside of "Article" was rejected. But the "Breadcrumbs" are still a legitimate part of the "WebPage". Seems both logical and odd to reject -- limited, perhaps. Maybe, there's a way to do this differentiation of nested elements, I haven't seen it yet.

4/29/2015

CSS: How to Center Floated Objects?

So, you're thinking, maybe:

I have these boxes inside a big box.
Or boxes inside of a table cell.
And they don't line up right in a pleasant way.
I want the layout to be more reponsive.

Problem:
aardvark
bird
cat
dog
eagle

And so maybe you decide to have them layout in an automatic fashion using float, like this:


aardvark
bird
cat
dog
eagle

aardvark
bird
cat
dog
eagle

It's not horrible, but it could look better, right?

So, how do you get a float to center inside the box?

You don't.

You change it
from: "float:left;"
to "display: inline-block;"
And do a "text-align:center; on the surrounding <div> or other surrounding element.

aardvark
bird
cat
dog
eagle

aardvark
bird
cat
dog
eagle

8/06/2011

How to turn on voice recognition in text field? Use Google speech recognition in forms?

To enable voice input for textfields in HTML5 / Google Chrome, add this to your input field's code:

   x-webkit-speech

----

IMPORTANT UPDATE (Nov. 2014): This function has been deprecated -- meaning, it doesn't work anymore. Google shut it down in February of 2014. I read there may have been a lagging shut-off security problem. It was kind of weird coding and a Chrome-only thing anyway.

BUT WAIT -- There is a replacement: A Javascript solution called the Web Speech API.


I'm researching it now. It appear to work just as well. Actually, it is even better -- way better!!! But it's not so simple to implement. I have it working and will make a new post soon. 


Again, though, it's only for the Chrome Desktop browser (as of November 2014). Safari claims it will have support for STT soon, too. Here's a couple of demos: for input and here for both input and output....


New Speech Synthesis Tutorial: Check out my Text-to-Speech tutorial which also uses Web Speech API -- AND it works in Chrome for desktop, Chrome mobile, Safari desktop and Safari mobile. Love it!


This is new technology, folks, for web programmers. It's very exciting stuff!!! Check back.





----

Here's an example:

<form>
   <input type="text" name="myTextInput" x-webkit-speech />
</form>

Yes, it's bad HTML coding. To be XHTML and HTML5 compliant:


<form>
   <input type="text" name="myTextInput" x-webkit-speech="x-webkit-speech" />
</form>

Ex.

Does it work with the iPhone or iPad version of Chrome?

If you're asking, then you probably already know the answer -- nope. "But," you might say, "iOS Chrome does recognize voice input in the URL field of the browser. So, if it can do that, then it should be able to use the textfield, too, right?" That would make a lot of sense, but sorry -- its not the case as of this posting.

That's rather disappointing for development of web apps, but Google will probably get around to it some day soon. Till then, no, there's nothing you can do to make it work right now.

Voice input is the s***!

Google's input microphone icon has a setting that will allow or disallow users to input cuss words and other insulting terms. A number of words, when spoken into the microphone, will turn into the first letter and a bunch of asterisks. That could be a problem if ... well, if you enjoy saying "bad words."

(I once wrote an in-depth article about this topic, listing all the possible A, B, C, F, M, N, S, & W-words that get weeded out by Google voice, but I'm not going to post them live again here, because -- um, I'd like to get another programming job someday.)

ACTION: If you right-click on the microphone, you will see a menu like this to "Block offensive words." Click to toggle this feature on or off.