Using Gatsby & DatoCMS.
I have many (20) models that all contain links to other models.
For example, on the home page "hero", cms users may point to different models/pages:
fragment homeHeroFragment on DatoCmsCompanyHome {
ctaLinkLabel
ctaLinkObject {
-- How to make this part reusable everywhere I have a "validated" Link:
... on DatoCmsCaseOverview {
type: __typename
id
locale
company {
slug
}
}
... on DatoCmsThemeOverview {
type: __typename
id
locale
company {
slug
}
}
... -- x roughly 20
}
}
Currently I have to explicitly reference each model that is allowed, as well as repeat this everywhere I have this kind of link which is ~ 20 places.
Does anyone know how to reuse this linkObject on multiple models so I have to write it only once? I can't simply interpolate, I can't write it as a reusable fragment as it needs to be mounted on many different files.
I'm considering writing a script for automatically generating these files. But I'm sure there's a better way.
Thanks!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…