Defining a relationship between a country and a recipe with Schema

我是研究僧i 提交于 2019-12-24 09:38:49

问题


I am building a web page that lists typical dishes for each individual country. Each dish is put in its own article and all of that goes fine. But I wonder if there is a way to link the Recipes to the country. Does it make sense to also specify the country with http://schema.org/Country, and if so how can I link that to the dishes?

I thought about defining the main as a country, and then using http://schema.org/additionalProperty but that doesn't seem to make sense as it expects a PropertyValue, which the recipes aren't.

<main>
  <h1>France</h1>
  <p>
    <span class="capital" title="Capital">Paris</span>
    <span class="member-since" title="Member of the EU since 1958">1958</span>
  </p>

  <article id="recipe-1" itemscope itemtype="http://schema.org/Recipe">
    <h1>Éclairs</h1>
    <!-- A lot of recipe-related stuff -->
  </article>

  <article id="recipe-2" itemscope itemtype="http://schema.org/Recipe">
    <h1>Macaron</h1>
    <!-- A lot of recipe-related stuff -->
  </article>

  <article id="recipe-3" itemscope itemtype="http://schema.org/Recipe">
    <h1>Tarte Tatin</h1>
    <!-- A lot of recipe-related stuff -->
  </article>
</main>

回答1:


You can provide the cuisine of a Recipe with its recipeCuisine property:

The cuisine of the recipe (for example, French or Ethiopian).

It expects a Text value.

There is also the locationCreated property, which expects a Place value (which includes Country), but it might be a stretch to use it in this context. Also it wouldn’t be clear if it refers to the location where the recipe is originally coming from, or to the location where the written form was created.

Schema.org doesn’t seem to offer a property to connect a Country and Recipe directly. But you could still connect the items via WebPage.
So for example, if you say WebPage about Country and WebPage mainEntity ItemList, and have each Recipe as itemListElement, there is at least some connection (a page about a specific country has a list of recipes as main content = the recipes are probably related to that country).



来源:https://stackoverflow.com/questions/43878609/defining-a-relationship-between-a-country-and-a-recipe-with-schema

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!