Nice programing

HTML 본문에 Schema Microdata 메타 태그를 넣습니까?

nicepro 2020. 11. 24. 19:55
반응형

HTML 본문에 Schema Microdata 메타 태그를 넣습니까?


나는이 질문에 대한 답변을 인터넷과 stackoverflow에서 오랫동안 검색했으며 본문에 메타 태그를 넣지 말아야한다는 링크를 찾았습니다.

schema.org 웹 사이트에는 http://schema.org/AggregateRating 본문에 직접 중첩되는 메타 태그가 명확하게 표시됩니다 .

거기에 게시 된 예제를보십시오

 Customer reviews:

  <div itemprop="reviews" itemscope itemtype="http://schema.org/Review">
    <span itemprop="name">Not a happy camper</span> -
    by <span itemprop="author">Ellie</span>,
    <meta itemprop="datePublished" content="2011-04-01">April 1, 2011
    <div itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating">
      <meta itemprop="worstRating" content = "1">
      <span itemprop="ratingValue">1</span>/
      <span itemprop="bestRating">5</span>stars
    </div>
    <span itemprop="description">The lamp burned out and now I have to replace
    it. </span>
  </div>


 <div itemprop="reviews" itemscope itemtype="http://schema.org/Review">
    <span itemprop="name">Value purchase</span> -
    by <span itemprop="author">Lucas</span>,
    <meta itemprop="datePublished" content="2011-03-25">March 25, 2011
    <div itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating">
      <meta itemprop="worstRating" content = "1"/>
      <span itemprop="ratingValue">4</span>/
      <span itemprop="bestRating">5</span>stars
    </div>
    <span itemprop="description">Great microwave for the price. It is small and
    fits in my apartment.</span>
  </div>

메타 태그를에서 유지한다면 <head>이 두 날짜를 리뷰와 어떻게 연관 시키겠습니까?<meta itemprop="datePublished" content="2011-04-01"> <meta itemprop="datePublished" content="2011-03-25">

이것은 혼란을 야기하고 있으며 올바르게 수행하는 방법을 알고 싶습니다.


만약 meta요소

  • 갖는 itemprop속성과 content특성 및
  • 더없는 name속성, 아니 http-equiv속성, 어떤 charset속성을,

다음은 이것을 가지고 유효한의 metabody. (값이 URL 인 경우 link대신을 사용해야 합니다 .)

왜? 마이크로 데이터 사양이 HTML5를 변경 하기 때문 입니다.

( RDFa는metabody 경우 에 따라 허용 하여 HTML5도 변경 합니다.)


meta태그 를 유지한다면 <head>이 두 날짜를 리뷰와 어떻게 연관 시키겠습니까?

속성을 사용할itemref있습니다 .

<!DOCTYPE html>
<html>
<head>
  <title>Using itemref for meta in the head</title>
  <meta itemprop="datePublished" content="2011-03-25" id="date">
</head>
<body>

  <div itemscope itemtype="http://schema.org/Review" itemref="date">
    <span itemprop="name">…</span>
  </div>

</body>
</html>

itemref takes a space-separated list of id values, so you can even reference two or more elements. Just add the id of all elements (containing itemprop attributes) that should be added to the item to its itemref attribute, e.g.: itemref="date author rating".


Remember also that it's possible to totally avoid HTML markup and use JSON-LD markup entirely contained in the <head> anywhere in the HTML document (even dynamically injected!) like this:

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "Restaurant",
  "name": "Fondue for Fun and Fantasy",
  "description": "Fantastic and fun for all your cheesy occasions",
  "openingHours": "Mo,Tu,We,Th,Fr,Sa,Su 11:30-23:00",
  "telephone": "+155501003333",
  "menu": "http://example.com/menu"
}
</script>

have a look at the examples in schema.org, they usually contain JSON example markups like this https://schema.org/Restaurant.

Here is another good article about it http://www.seoskeptic.com/json-ld-google-knowledge-graph-schema-org-seo/


What I can read from whatwg.org it's correct to use in body: http://www.whatwg.org/specs/web-apps/current-work/multipage/semantics.html#the-meta-element

I use meta tags in the body of my blogg to specify the "datePublished" and "dateUpdated" properties. Googles Rich Snippets Testing Tool tells me it's correct and w3c validates the code.


You can use:

<meta itemprop="">

in the body of the page to do schema.org semantic markup that is machine readable (by robots, for SEO, for instance) even if you don't want to display the actual text (product name, for example) on the page.

see: http://schema.org/docs/gs.html#advanced_missing

Sometimes, a web page has information that would be valuable to mark up, but the information can't be marked up because of the way it appears on the page. The information may be conveyed in an image (for example, an image used to represent a rating of 4 out of 5) or a Flash object (for example, the duration of a video clip), or it may be implied but not stated explicitly on the page (for example, the currency of a price).


I do it this way:

<meta id="md_course" itemprop="course" name="course"   content="..."/>
<meta id="md_lang" itemprop="language" content="eng"/>
<title id="md_title" itemprop="title" >Motivation and Course Overview</title>
</head>
<body itemscope itemtype=".../Presentation" itemref="md_course md_lang md_title md_field"> 

When first working with schema.org's microdata, I added the meta tags in the head tag of my web page but when I ran that page against Google's Rich Snippets Testing Tool, the data was not extracted. I then moved the meta tags into the body of the page and the data was shown as being extracted.

참고URL : https://stackoverflow.com/questions/10279277/do-you-put-schema-microdata-meta-tags-in-the-html-body

반응형