This repository has been archived by the owner on Feb 11, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* docs: mention forgotten fix in changelog (and remove commits not relevant) * Add formatting for page types Co-authored-by: Vincent Velociter <[email protected]>
- Loading branch information
Showing
2 changed files
with
6 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -212,9 +212,12 @@ exports.createPages = async ({ graphql, actions: { createPage } }: any, options: | |
endCursor: string = '', | ||
documents: Edge[] = [] | ||
): Promise<Edge[]> { | ||
// Format page.type so that the graphql query doesn't complain. | ||
const pageTypeUnderscored = page.type.toLowerCase().split(' ').join('_'); | ||
const pageTypeFormatted = pageTypeUnderscored.charAt(0).toUpperCase() + pageTypeUnderscored.slice(1); | ||
// Prepare and execute query | ||
const documentType: string = `all${page.type}s`; | ||
const sortType: string = `PRISMIC_Sort${page.type}y`; | ||
const documentType: string = `all${pageTypeFormatted}s`; | ||
const sortType: string = `PRISMIC_Sort${pageTypeFormatted}y`; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
noblica
Author
Contributor
|
||
const extraPageFields = options.extraPageFields || ''; | ||
const query: string = getDocumentsQuery({ documentType, sortType, extraPageFields }); | ||
const { data, errors } = await graphql(query, { | ||
|
I Have a question @noblica @veloce why the sortType value should finish with the letter "y"?
Few hours ago the value have thrown error in my project.
I replicated the last output query value. Just we suppose that page.type is equals to "Basic_page"
Query response: