Assemble を使用して新しいサイトを生成しており、可能な限りモジュール化したいと考えています。コンポーネントの 1 つは、データのリストをループし、アイテムのリストを生成します。
私のコンポーネントは評価と呼ばれ、次のようになります。
---
ratings:
- review: I would recommend this company.
reviewRating: 10
reviewLocation: Berkhamsted
reviewDate: 11/03/2014
- review: Very pleasant, very prompt, fantastic, I would recommend them.
reviewRating: 10
reviewLocation: Cranbrook
reviewDate: 11/02/2014
- review: Very reliable and very nice people to have around your property, great workmanship.
reviewRating: 10
reviewLocation: Chelmsford
reviewDate: 16/10/2013
- review: Excellent service and I have recommended them to other people
reviewRating: 10
reviewLocation: Dartford
reviewDate: 14/06/2013
- review: Very professional and great installation. I would have them back. Couldn't more pleased with them. Outstanding, top class.
reviewRating: 10
reviewLocation: Halstead
reviewDate: 29/04/2013
---
{{#forEach ratings}}
{{reviewRating}} - {{review}} -- {{reviewLocation}} --- {{reviewDate}}
{{/forEach}}
そして、私のページには次のものがあります。
{{> ratings }}
その後、Assemble ファイルをコンパイルすると、次のエラーが発生します。
警告: 未定義のプロパティ '長さ' を読み取ることができません --force を使用して続行してください。
しかし、ページにデータとループを含めると、正常に機能しますが、再利用はできません。