20

I googled is html a language.

Like (almost) always, SE was first. However, they actually answered my question in a fancy box!

google result

I read it, and clicked the link because I needed to know how many upvotes the answer got. It got 2 upvotes and is near the bottom, since there are many answers to this question. The top (selected) answer has 317, and is also the description being pulled for the second top listing, as shown above.

Here is the question: Is HTML considered a programming language?

I would think this should be fixed, but maybe it is intentional, as the shown answer DOES agree with the top answer, and is short enough to fit properly.

6
  • 8
    BRB, going to fix that "your". Odd they picked a low-score answer for the box.
    – user1228
    Commented Jun 10, 2014 at 18:11
  • 3
    Retagging as discussion - this is not something we currently have control over. There is a nice little feedback link there, perhaps that's a good port of call?
    – Oded
    Commented Jun 10, 2014 at 18:11
  • @Oded at the very least, one day, if we have control, it will be good to know! Commented Jun 10, 2014 at 18:12
  • @Won't Jeez, why didn't you do that when you closed it? Slacker.
    – animuson StaffMod
    Commented Jun 10, 2014 at 18:13
  • 1
    @Won't people might get it in their head to spell your name without the ' as well :p Commented Jun 10, 2014 at 18:14
  • @animuson: Same reason why I don't wipe my butt when I forget to flush. Or something.
    – user1228
    Commented Jun 10, 2014 at 18:22

2 Answers 2

19

If there is a problem in the way Google features work, then that's a bug for Google, not Stack Exchange.

The feature is only visible when searching on Google.com (and then only some of the time), and there is a feedback link below it in your screenshot. Perhaps you could use that to report the problem?

When you do (I clicked Not Useful), there is also a Learn More link, which tells us:

Search is constantly evolving. In a typical year, we experiment with tens of thousands of possible changes. Every change is tested in an experiment where some users see the change and others don’t. By getting your feedback on our experiments, we learn which experiments are successful and should become part of Google Search for everyone.

The feature is experimental, and they want your feedback, so give it to them, not us!

Unless you can figure out what metadata Google uses and how Stack Exchange could influence this, there is little point in calling this a bug. As far as I can tell, Google just picks an excerpt from all text on that page that contains the keywords, nothing more.

Update: for me, the box now highlights text from the top-voted answer:

Google box

Perhaps the Not Useful clicks had an effect?

2
  • 1
    Last time I checked, websites can control, to the very least, some of the content that search engines display. Also, the feedback link only wants to know if you found it useful. Commented Jun 10, 2014 at 17:55
  • 9
    @JacobRaccuia: Then find out what Stack Exchange can do to influence this. Until Google explicitly publishes how their feature determines what excerpt to show, there is nothing we can do. Commented Jun 10, 2014 at 17:57
32

We do have influence over this, using a feature the Google bot listens to: HTML5 microdata. It's a set of attributes you can add to HTML5 elements to guide machines in better understanding the content of a page.

I say the Google bot listens to microdata with certainty: Google itself recommends using microdata for interacting with their search engine. They are also one of the collaborators who made the current standard vocabulary for microdata - schema.org - according to their schema.org FAQ.

Schema.org contains a Question schema and an Answer schema (there's also the full schema list if you want to browse). We can take advantage of the acceptedAnswer property to guide Google to provide the right answer in its searches: we'll mark the accepted answer as the one that's, well, accepted, or if none is, the one that has the most votes.

Stack Exchange's development team is already using microdata, as can be seen by examining this question itself:

Look for div#content

They currently define questions as Articles, so let's define them as Questions instead. It might look like the below. I'll ignore most of the HTML which Stack Exchange uses, including the votes and stuff, in favour of just getting the idea across.

<!-- Define the entire page as a QA page -->
<body itemscope itemtype="http://schema.org/QAPage">

    <!-- Wrapping the entire question, and all answers... -->
    <div itemscope itemtype="http://schema.org/Question">

        <!-- This is the element containing all the stuff specific to our question. -->
        <div id="question">
            <h1 itemprop="name">Is HTML a programming language?</h1>
            <div itemprop="text">So I was wondering...</div>
        </div>

        <!-- Further down, all the answers begin. -->
        <div id="answers">

            <h2><span itemprop="answerCount">4</span> answers</h2>

            <div itemprop="acceptedAnswer" itemscope itemtype="http://schema.org/Answer">
                <div itemprop="text">No it isn't</div>
            </div>

            <div itemscope itemtype="http://schema.org/Answer">
                <div itemprop="text">(a different answer)</div>
            </div>

        </div> <!-- End answers list -->
    </div> <!-- End question -->
</body>

The following attributes (helpfully syntax-highlighted) are the microdata ones:

  • itemscope, which says "this element defines one whole item"
  • itemtype, which says "this the kind of thing I am defining"
  • itemprop, which defines the various properties of that thing.

Note that in microdata, all properties are optional to define, so we just define as much as is relevant or as much as we want.

An aside about vote counts

We could possibly also provide the vote count for the question and answers, which may mean not having to say an accepted answer is accepted. There's a complication, though: the Question and Answer schemas don't have a simple voteCount or score property. Instead, they have separate upvoteCount and downvoteCount properties.

So we have a couple of options:

  • Report the question's score via the upvoteCount attribute. This appears to be the behaviour used by their microdata examples on the Question and Answer schemas.
    • On June 11th, I noticed the microdata examples on the Question and Answer schemas used a voteCount property not listed in the properties tables for those schemas. I requested clarification on whether it existed. As of June 17th (possibly sooner), they updated their microdata examples to remove mention of a voteCount property and just used the upvoteCount property.
  • Use the aggregateRating.ratingValue property of the Question/Answer schema, as Martijn Pieters points out in comments.
  • Reveal the upvote/downvote count. According to words that end in GRY this may be publicly available information anyway, via the API.
12
  • 5
    The schema docs even acknowledge Stack Overflow as inspiration. Commented Jun 11, 2014 at 0:05
  • 2
    What is not known however if Google a) uses the QA schemas and b) would use it for the experimental feature encountered by the OP. Commented Jun 11, 2014 at 0:06
  • It does. I've added a couple of links. Commented Jun 11, 2014 at 0:07
  • 2
    Top-level should be schema.org/QAPage; I've pinged Kevin Montrose about updating the Schema.org tagging. Commented Jun 11, 2014 at 0:22
  • The weird thing with the current Question schema is that the acceptedAnswer property is a property of the question, and it has to be an answer - not just a reference to one. So the question has to contain all of the answers (including the Question information itself), and one of them has to be marked as the accepted answer. So it would be QAPage > Question > Answers [including acceptedAnswer] Commented Jun 11, 2014 at 1:39
  • 1
    The QAPage has an annotated example; they mark the <body> tag with QAPage, then mark out the question and answer. The CreativeWork.aggregateRating field can stand in for score here; see the wiki page as well. The up and downvote fields were added on top of aggregateRating Commented Jun 11, 2014 at 11:53
  • 1
    AggregateRating seems to do heavy lifting far beyond just providing a score. But maybe the aggregateRating.ratingValue property will do, leaving out everything else. Commented Jun 11, 2014 at 11:55
  • Yeah, that's what I envisioned. Commented Jun 11, 2014 at 11:57
  • 2
    Upvote and downvote counts are public information; they are available in real-time through API, and also through Data Explorer. Neither requires authorization. I recall StackApps has a script that shows these counts automatically using API. So it's not a problem if the counts get embedded in the markup of the page.
    – user259867
    Commented Jun 11, 2014 at 23:04
  • 1
    The upvote/downvote counts on questions are also available via /posts/nnnnnn/timeline, where nnnnn is the Post Id.
    – user259867
    Commented Jul 2, 2014 at 2:31
  • 5
    I see that posts now do use the markup you proposed, including the acceptedAnswer itemprop. Commented Aug 14, 2014 at 11:55
  • @Martijn Oh, hey, awesome. :) Commented Aug 14, 2014 at 21:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .