Skip to content

Commit e49212d

Browse files
committed
Wrap content type attributes in its object
and lookup the 'attributes' object during linking
1 parent 9acd2c3 commit e49212d

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
---
22
name: Person
3-
articles: [+Article:author]
4-
demos: [+Demo:maker]
5-
events: [+Event:organizers, +Event:participants]
6-
books: [+Book:author]
7-
twin: +Person:twin
3+
attributes:
4+
articles: [+Article:author]
5+
demos: [+Demo:maker]
6+
events: [+Event:organizers, +Event:participants]
7+
books: [+Book:author]
8+
twin: +Person:twin
89
---

src/ssg/lib/linking.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ function findLinkedNode(nodes, linkPath) {
3131

3232
function addLinkBack(sourceNode, targetNode, key) {
3333
if (sourceNode.schema) {
34-
Object.keys(sourceNode.schema).forEach(schemaKey => {
35-
const schemaValue = sourceNode.schema[schemaKey]
34+
Object.keys(sourceNode.schema.attributes || []).forEach(schemaKey => {
35+
const schemaValue = sourceNode.schema.attributes[schemaKey]
3636
const isSchemaValueArray = Array.isArray(schemaValue)
3737
const re = new RegExp(`^\\+(${targetNode.contentType}|):${key}$`)
3838
const match = isSchemaValueArray ?

0 commit comments

Comments
 (0)