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;








1















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.










share|improve this question
























  • 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











  • 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

















1















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.










share|improve this question
























  • 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











  • 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













1












1








1








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.










share|improve this question














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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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 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











  • 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











  • *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












1 Answer
1






active

oldest

votes


















2














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 ...





  • lang could be a variable you pass into createPage action 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 & scheduledItem are alias name that make it easier to retrieve your data. You can access the data like data.languagePage... & data.scheduledItem...

Let me know if that helps.






share|improve this answer



























  • 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











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
);



);













draft saved

draft discarded


















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









2














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 ...





  • lang could be a variable you pass into createPage action 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 & scheduledItem are alias name that make it easier to retrieve your data. You can access the data like data.languagePage... & data.scheduledItem...

Let me know if that helps.






share|improve this answer



























  • 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
















2














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 ...





  • lang could be a variable you pass into createPage action 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 & scheduledItem are alias name that make it easier to retrieve your data. You can access the data like data.languagePage... & data.scheduledItem...

Let me know if that helps.






share|improve this answer



























  • 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














2












2








2







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 ...





  • lang could be a variable you pass into createPage action 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 & scheduledItem are alias name that make it easier to retrieve your data. You can access the data like data.languagePage... & data.scheduledItem...

Let me know if that helps.






share|improve this answer















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 ...





  • lang could be a variable you pass into createPage action 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 & scheduledItem are alias name that make it easier to retrieve your data. You can access the data like data.languagePage... & data.scheduledItem...

Let me know if that helps.







share|improve this answer














share|improve this answer



share|improve this answer








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


















  • 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









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.



















draft saved

draft discarded
















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해