google / google/react-schemaorg

How to make BreadcrumbList with multiple breadcrumb trails

オープン
#47 コメント 0 件 リアクション 1 件 担当者 0 名 GitHub で見る
主要言語
TypeScript
スター
521
フォーク
20
PR マージ指標
30日以内にマージされた PR はありません

説明

According to the Google docs [here](https://developers.google.com/search/docs/appearance/structured-data/breadcrumb#html_example) it should be possible to have multiple BreadcrumbList items in an array inside the script tag. However, this doesn't seem possible with react-schemaorg since you cannot pass an array of objects to jsonLdScriptProps() you can only pass a single object.

What I would like to do is:
```
const data = jsonLdScriptProps(
[{
"@context": "https://schema.org",
"@type": "BreadcrumbList",
"@id": "/#breadcrumlist",
itemListElement: [
{
"@type": "ListItem",
position: 1,
name: "Articles",
item: "https://example.com/",
},
{
"@type": "ListItem",
position: 2,
name: "Archive",
item: `https://example.com/a/${utcYear}/${utcMonth}/`,
},
],
},
{
"@context": "https://schema.org",
"@type": "BreadcrumbList",
"@id": "/#breadcrumlist",
itemListElement: [
{
"@type": "ListItem",
position: 1,
name: "Home",
item: "https://example.com/",
},
{
"@type": "ListItem",
position: 2,
name: `${section}`,
item: `https://example.com/sections/${section}/`,
},
],
},
);
```
But this generates an error:
```
Type 'BreadcrumbListLeaf[]' does not satisfy the constraint 'Thing'.
Property '"@type"' is missing in type 'BreadcrumbListLeaf[]' but required in type 'TouristDestinationLeaf'.ts(2344)
```

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

jsonLdScriptProps() の型シグネチャから始めて、その入力がどのように表現され、レンダリングされるかを追跡します。既存の単一オブジェクトの動作を維持したまま BreadcrumbList[] を受け入れられるかを判断し、その結果の JSON-LD に要求された複数のパンくずリストの経路が含まれていることを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
react, typescript
領域
api
issue の種類
機能追加
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。