Replies: 1 comment
-
Try extracting the selection of You can move this fragment to the separate js file if needed: fragment MyLink on Node {
type: __typename
id
... on DatoCmsCaseOverview {
locale
company {
slug
}
}
... on DatoCmsThemeOverview {
locale
company {
slug
}
}
# ... -- x roughly 20
} And then use it anywhere you need it: fragment homeHeroFragment on DatoCmsCompanyHome {
ctaLinkLabel
ctaLinkObject {
...MyLink
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
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:
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!
Beta Was this translation helpful? Give feedback.
All reactions