Is it possible to create a GraphQL subquery to create an array as an element of a markdownRemark?GraphQL ignores some (but not all) arbitrarily assigned markdown frontmatter dataGatsbyJS : Accessing different sections of a blog post saved in markdown file (GraphQL)GatsbyJs - How to handle empty graphql node from Contentful pluginComponent props to GraphQLGatsby, how to do “join” with graphql?Separate page graphQL queries in separate files (.graphql)Is it possible to use dynamic query alias names in GraphQL?Graphql query in Gatsby static query component with markdown fileGraphQL Error Field “image” of type “File” must have a selection of subfields. Did you mean “image … ”?Sort YAML file content by date with GraphQL?
Does Ubuntu reduce battery life?
To which atoms correspond left and right in showlists?
May a hotel provide accommodation for fewer people than booked?
Sub-dependencies and code disclosure
Why are subdominants unstable?
Why would an invisible personal shield be necessary?
Should I intervene when a colleague in a different department makes students run laps as part of their grade?
What are the closest international airports in different countries?
Why doesn't the Gottesman-Knill theorem render quantum computing almost useless?
Just how much information should you share with a former client?
If the Moon were impacted by a suitably sized meteor, how long would it take to impact the Earth?
Exploiting the delay when a festival ticket is scanned
Why don't short runways use ramps for takeoff?
Are all French verb conjugation tenses and moods practical and efficient?
My employer is refusing to give me the pay that was advertised after an internal job move
Why tantalum for the Hayabusa bullets?
Bouncing map back into its bounds, after user dragged it out
What were the first chips with hardware support for SPI?
How did the SysRq key get onto modern keyboards if it's rarely used?
How to find the three closest (nearest) values within a vector?
How do I make my photos have more impact?
On the sensitivity conjecture?
A variant of the Multiple Traveling Salesman Problem
Antonym of "Megalomania"
Is it possible to create a GraphQL subquery to create an array as an element of a markdownRemark?
GraphQL ignores some (but not all) arbitrarily assigned markdown frontmatter dataGatsbyJS : Accessing different sections of a blog post saved in markdown file (GraphQL)GatsbyJs - How to handle empty graphql node from Contentful pluginComponent props to GraphQLGatsby, how to do “join” with graphql?Separate page graphQL queries in separate files (.graphql)Is it possible to use dynamic query alias names in GraphQL?Graphql query in Gatsby static query component with markdown fileGraphQL Error Field “image” of type “File” must have a selection of subfields. Did you mean “image … ”?Sort YAML file content by date with GraphQL?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I'm making a webpage for a language school and am now trying to create pages about languages taught there. They're supposed to include the name of the language, a short descroption and a list of schedule items related to them. In Netlify CMS I made 2 collections for them. One of them has the general language information and the other one includes the schedule items.
What I would like to do when I enter a language's webpage is get the general infromation from the language_pages collection and an array of schedule_items with the same value in the language field, but I'm kind of scratching my head trying to figure out how to do it.
Each of the 2 collections includes a templateKey field, which differentiates between the collections. The values are language-post for general language information and schedule-item for schedule items.
My basic query to get a single language page is the following:
query
markdownRemark(frontmatter: language: eq: "Niemiecki" )
html
frontmatter
language
description
The field language also exists in the schedule item collection, so I'm thinking I should somehow use it to filter through the collection. I'm a complete graphQL noob, however and I haven't really found and example of what I'm trying to do here being done. My complete bodge-job resulted in something like this:
query
markdownRemark(frontmatter: language: eq: "Niemiecki" )
html
frontmatter
language
description
children
id
group
room
time
Which doesn't even execute properly and I'm honestly out of ideas how I could make it work.
graphql gatsby netlify-cms
add a comment |
I'm making a webpage for a language school and am now trying to create pages about languages taught there. They're supposed to include the name of the language, a short descroption and a list of schedule items related to them. In Netlify CMS I made 2 collections for them. One of them has the general language information and the other one includes the schedule items.
What I would like to do when I enter a language's webpage is get the general infromation from the language_pages collection and an array of schedule_items with the same value in the language field, but I'm kind of scratching my head trying to figure out how to do it.
Each of the 2 collections includes a templateKey field, which differentiates between the collections. The values are language-post for general language information and schedule-item for schedule items.
My basic query to get a single language page is the following:
query
markdownRemark(frontmatter: language: eq: "Niemiecki" )
html
frontmatter
language
description
The field language also exists in the schedule item collection, so I'm thinking I should somehow use it to filter through the collection. I'm a complete graphQL noob, however and I haven't really found and example of what I'm trying to do here being done. My complete bodge-job resulted in something like this:
query
markdownRemark(frontmatter: language: eq: "Niemiecki" )
html
frontmatter
language
description
children
id
group
room
time
Which doesn't even execute properly and I'm honestly out of ideas how I could make it work.
graphql gatsby netlify-cms
so you have 2 folders for each collection, and they are both markdown & each haslanguageas a field infrontmatter?
– Derek Nguyen
Mar 26 at 22:26
*a folder for each collection
– Derek Nguyen
Mar 26 at 22:38
Each collection has a folder, the include markown pages and have a language field in the frontmatter, correct.
– Kuba Chmiel
Mar 27 at 5:49
add a comment |
I'm making a webpage for a language school and am now trying to create pages about languages taught there. They're supposed to include the name of the language, a short descroption and a list of schedule items related to them. In Netlify CMS I made 2 collections for them. One of them has the general language information and the other one includes the schedule items.
What I would like to do when I enter a language's webpage is get the general infromation from the language_pages collection and an array of schedule_items with the same value in the language field, but I'm kind of scratching my head trying to figure out how to do it.
Each of the 2 collections includes a templateKey field, which differentiates between the collections. The values are language-post for general language information and schedule-item for schedule items.
My basic query to get a single language page is the following:
query
markdownRemark(frontmatter: language: eq: "Niemiecki" )
html
frontmatter
language
description
The field language also exists in the schedule item collection, so I'm thinking I should somehow use it to filter through the collection. I'm a complete graphQL noob, however and I haven't really found and example of what I'm trying to do here being done. My complete bodge-job resulted in something like this:
query
markdownRemark(frontmatter: language: eq: "Niemiecki" )
html
frontmatter
language
description
children
id
group
room
time
Which doesn't even execute properly and I'm honestly out of ideas how I could make it work.
graphql gatsby netlify-cms
I'm making a webpage for a language school and am now trying to create pages about languages taught there. They're supposed to include the name of the language, a short descroption and a list of schedule items related to them. In Netlify CMS I made 2 collections for them. One of them has the general language information and the other one includes the schedule items.
What I would like to do when I enter a language's webpage is get the general infromation from the language_pages collection and an array of schedule_items with the same value in the language field, but I'm kind of scratching my head trying to figure out how to do it.
Each of the 2 collections includes a templateKey field, which differentiates between the collections. The values are language-post for general language information and schedule-item for schedule items.
My basic query to get a single language page is the following:
query
markdownRemark(frontmatter: language: eq: "Niemiecki" )
html
frontmatter
language
description
The field language also exists in the schedule item collection, so I'm thinking I should somehow use it to filter through the collection. I'm a complete graphQL noob, however and I haven't really found and example of what I'm trying to do here being done. My complete bodge-job resulted in something like this:
query
markdownRemark(frontmatter: language: eq: "Niemiecki" )
html
frontmatter
language
description
children
id
group
room
time
Which doesn't even execute properly and I'm honestly out of ideas how I could make it work.
graphql gatsby netlify-cms
graphql gatsby netlify-cms
asked Mar 26 at 21:26
Kuba ChmielKuba Chmiel
247 bronze badges
247 bronze badges
so you have 2 folders for each collection, and they are both markdown & each haslanguageas a field infrontmatter?
– Derek Nguyen
Mar 26 at 22:26
*a folder for each collection
– Derek Nguyen
Mar 26 at 22:38
Each collection has a folder, the include markown pages and have a language field in the frontmatter, correct.
– Kuba Chmiel
Mar 27 at 5:49
add a comment |
so you have 2 folders for each collection, and they are both markdown & each haslanguageas a field infrontmatter?
– Derek Nguyen
Mar 26 at 22:26
*a folder for each collection
– Derek Nguyen
Mar 26 at 22:38
Each collection has a folder, the include markown pages and have a language field in the frontmatter, correct.
– Kuba Chmiel
Mar 27 at 5:49
so you have 2 folders for each collection, and they are both markdown & each has
language as a field in frontmatter?– Derek Nguyen
Mar 26 at 22:26
so you have 2 folders for each collection, and they are both markdown & each has
language as a field in frontmatter?– Derek Nguyen
Mar 26 at 22:26
*a folder for each collection
– Derek Nguyen
Mar 26 at 22:38
*a folder for each collection
– Derek Nguyen
Mar 26 at 22:38
Each collection has a folder, the include markown pages and have a language field in the frontmatter, correct.
– Kuba Chmiel
Mar 27 at 5:49
Each collection has a folder, the include markown pages and have a language field in the frontmatter, correct.
– Kuba Chmiel
Mar 27 at 5:49
add a comment |
1 Answer
1
active
oldest
votes
You can do 2 queries side by side & filter by folder name with regex:
query LanguageInfo($lang: String)
languagePage: markdownRemark(
frontmatter: language: eq: $lang ,
fileAbsolutePath:
regex: "/your-language-folder-name/"
)
frontmatter ...
scheduledItem: markdownRemark(
frontmatter: language: eq: $lang ,
fileAbsolutePath:
regex: "/your-schedule-folder-name/"
)
frontmatter ...
langcould be a variable you pass intocreatePageaction when you create page programmatically. You can then use it in your page template's query. Example from the doc in case you need it:
createPage(
path: `/my-sweet-new-page/`,
component: path.resolve(`./src/templates/my-sweet-new-page.js`),
// The context is passed as props to the component as well
// as into the component's GraphQL query.
context:
lang: `english`,
,
)
languagePage&scheduledItemare alias name that make it easier to retrieve your data. You can access the data likedata.languagePage...&data.scheduledItem...
Let me know if that helps.
I think this query does what I'm looking for, just need to adjust the rest of my code to fit it :) Thank you very much.
– Kuba Chmiel
Mar 27 at 18:17
I can now confirm it worked as intended. Thank you very much again.
– Kuba Chmiel
Mar 27 at 19:07
i there a public github repo to see how you resolved it?
– muescha
Apr 3 at 18:55
Nope, sorry, I was doing a commercial project when I encountered this problem. The code is in a private repo. If you have any other questions however, I'll be happy to help
– Kuba Chmiel
May 18 at 10:07
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55366445%2fis-it-possible-to-create-a-graphql-subquery-to-create-an-array-as-an-element-of%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can do 2 queries side by side & filter by folder name with regex:
query LanguageInfo($lang: String)
languagePage: markdownRemark(
frontmatter: language: eq: $lang ,
fileAbsolutePath:
regex: "/your-language-folder-name/"
)
frontmatter ...
scheduledItem: markdownRemark(
frontmatter: language: eq: $lang ,
fileAbsolutePath:
regex: "/your-schedule-folder-name/"
)
frontmatter ...
langcould be a variable you pass intocreatePageaction when you create page programmatically. You can then use it in your page template's query. Example from the doc in case you need it:
createPage(
path: `/my-sweet-new-page/`,
component: path.resolve(`./src/templates/my-sweet-new-page.js`),
// The context is passed as props to the component as well
// as into the component's GraphQL query.
context:
lang: `english`,
,
)
languagePage&scheduledItemare alias name that make it easier to retrieve your data. You can access the data likedata.languagePage...&data.scheduledItem...
Let me know if that helps.
I think this query does what I'm looking for, just need to adjust the rest of my code to fit it :) Thank you very much.
– Kuba Chmiel
Mar 27 at 18:17
I can now confirm it worked as intended. Thank you very much again.
– Kuba Chmiel
Mar 27 at 19:07
i there a public github repo to see how you resolved it?
– muescha
Apr 3 at 18:55
Nope, sorry, I was doing a commercial project when I encountered this problem. The code is in a private repo. If you have any other questions however, I'll be happy to help
– Kuba Chmiel
May 18 at 10:07
add a comment |
You can do 2 queries side by side & filter by folder name with regex:
query LanguageInfo($lang: String)
languagePage: markdownRemark(
frontmatter: language: eq: $lang ,
fileAbsolutePath:
regex: "/your-language-folder-name/"
)
frontmatter ...
scheduledItem: markdownRemark(
frontmatter: language: eq: $lang ,
fileAbsolutePath:
regex: "/your-schedule-folder-name/"
)
frontmatter ...
langcould be a variable you pass intocreatePageaction when you create page programmatically. You can then use it in your page template's query. Example from the doc in case you need it:
createPage(
path: `/my-sweet-new-page/`,
component: path.resolve(`./src/templates/my-sweet-new-page.js`),
// The context is passed as props to the component as well
// as into the component's GraphQL query.
context:
lang: `english`,
,
)
languagePage&scheduledItemare alias name that make it easier to retrieve your data. You can access the data likedata.languagePage...&data.scheduledItem...
Let me know if that helps.
I think this query does what I'm looking for, just need to adjust the rest of my code to fit it :) Thank you very much.
– Kuba Chmiel
Mar 27 at 18:17
I can now confirm it worked as intended. Thank you very much again.
– Kuba Chmiel
Mar 27 at 19:07
i there a public github repo to see how you resolved it?
– muescha
Apr 3 at 18:55
Nope, sorry, I was doing a commercial project when I encountered this problem. The code is in a private repo. If you have any other questions however, I'll be happy to help
– Kuba Chmiel
May 18 at 10:07
add a comment |
You can do 2 queries side by side & filter by folder name with regex:
query LanguageInfo($lang: String)
languagePage: markdownRemark(
frontmatter: language: eq: $lang ,
fileAbsolutePath:
regex: "/your-language-folder-name/"
)
frontmatter ...
scheduledItem: markdownRemark(
frontmatter: language: eq: $lang ,
fileAbsolutePath:
regex: "/your-schedule-folder-name/"
)
frontmatter ...
langcould be a variable you pass intocreatePageaction when you create page programmatically. You can then use it in your page template's query. Example from the doc in case you need it:
createPage(
path: `/my-sweet-new-page/`,
component: path.resolve(`./src/templates/my-sweet-new-page.js`),
// The context is passed as props to the component as well
// as into the component's GraphQL query.
context:
lang: `english`,
,
)
languagePage&scheduledItemare alias name that make it easier to retrieve your data. You can access the data likedata.languagePage...&data.scheduledItem...
Let me know if that helps.
You can do 2 queries side by side & filter by folder name with regex:
query LanguageInfo($lang: String)
languagePage: markdownRemark(
frontmatter: language: eq: $lang ,
fileAbsolutePath:
regex: "/your-language-folder-name/"
)
frontmatter ...
scheduledItem: markdownRemark(
frontmatter: language: eq: $lang ,
fileAbsolutePath:
regex: "/your-schedule-folder-name/"
)
frontmatter ...
langcould be a variable you pass intocreatePageaction when you create page programmatically. You can then use it in your page template's query. Example from the doc in case you need it:
createPage(
path: `/my-sweet-new-page/`,
component: path.resolve(`./src/templates/my-sweet-new-page.js`),
// The context is passed as props to the component as well
// as into the component's GraphQL query.
context:
lang: `english`,
,
)
languagePage&scheduledItemare alias name that make it easier to retrieve your data. You can access the data likedata.languagePage...&data.scheduledItem...
Let me know if that helps.
edited Mar 27 at 7:28
answered Mar 27 at 7:19
Derek NguyenDerek Nguyen
4,2411 gold badge6 silver badges24 bronze badges
4,2411 gold badge6 silver badges24 bronze badges
I think this query does what I'm looking for, just need to adjust the rest of my code to fit it :) Thank you very much.
– Kuba Chmiel
Mar 27 at 18:17
I can now confirm it worked as intended. Thank you very much again.
– Kuba Chmiel
Mar 27 at 19:07
i there a public github repo to see how you resolved it?
– muescha
Apr 3 at 18:55
Nope, sorry, I was doing a commercial project when I encountered this problem. The code is in a private repo. If you have any other questions however, I'll be happy to help
– Kuba Chmiel
May 18 at 10:07
add a comment |
I think this query does what I'm looking for, just need to adjust the rest of my code to fit it :) Thank you very much.
– Kuba Chmiel
Mar 27 at 18:17
I can now confirm it worked as intended. Thank you very much again.
– Kuba Chmiel
Mar 27 at 19:07
i there a public github repo to see how you resolved it?
– muescha
Apr 3 at 18:55
Nope, sorry, I was doing a commercial project when I encountered this problem. The code is in a private repo. If you have any other questions however, I'll be happy to help
– Kuba Chmiel
May 18 at 10:07
I think this query does what I'm looking for, just need to adjust the rest of my code to fit it :) Thank you very much.
– Kuba Chmiel
Mar 27 at 18:17
I think this query does what I'm looking for, just need to adjust the rest of my code to fit it :) Thank you very much.
– Kuba Chmiel
Mar 27 at 18:17
I can now confirm it worked as intended. Thank you very much again.
– Kuba Chmiel
Mar 27 at 19:07
I can now confirm it worked as intended. Thank you very much again.
– Kuba Chmiel
Mar 27 at 19:07
i there a public github repo to see how you resolved it?
– muescha
Apr 3 at 18:55
i there a public github repo to see how you resolved it?
– muescha
Apr 3 at 18:55
Nope, sorry, I was doing a commercial project when I encountered this problem. The code is in a private repo. If you have any other questions however, I'll be happy to help
– Kuba Chmiel
May 18 at 10:07
Nope, sorry, I was doing a commercial project when I encountered this problem. The code is in a private repo. If you have any other questions however, I'll be happy to help
– Kuba Chmiel
May 18 at 10:07
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55366445%2fis-it-possible-to-create-a-graphql-subquery-to-create-an-array-as-an-element-of%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
so you have 2 folders for each collection, and they are both markdown & each has
languageas a field infrontmatter?– Derek Nguyen
Mar 26 at 22:26
*a folder for each collection
– Derek Nguyen
Mar 26 at 22:38
Each collection has a folder, the include markown pages and have a language field in the frontmatter, correct.
– Kuba Chmiel
Mar 27 at 5:49