gatsby

How can I set the index page of my Gatsby site to be one of the dynamically generated pages?

跟風遠走 提交于 2020-02-25 05:05:32
问题 I have a Gatsby site that queries information from a Wordpress REST API with GraphQL to dynamically create the site pages. I'd like to set my index page to be the homepage that is being created dynamically i.e home.html I saw this post that was similar On Gatsby CMS how can i set the about page as a index page However, they have an about.js file that corresponds to their about page, meaning they can export it as a component and use it in index or they can even just copy the contents of that

Is it possible to skip creating a page during build if that page ends up throwing during render?

梦想的初衷 提交于 2020-02-25 04:37:48
问题 Is it possible to skip creating a page during build if that page ends up throwing during render? This page is created programmatically via gatsby-node createPage and it's possible that the data from a page query (from our CMS) is bad causing it to throw. I don't want stop the build due to one bad page so ideally the page wouldn't be created or a fallback page would be put into its place (and an error event would be logged to Sentry or similar). Any ideas on how to achieve this? Edit: I didn't

Gatsby: what's the difference between basepath and path prefix?

时间秒杀一切 提交于 2020-02-22 08:13:25
问题 I don't understand the difference between basepath and path prefix in Gatsby , and when to use each feature Basepath: https://www.gatsbyjs.org/tutorial/part-seven/ Path prefix: https://www.gatsbyjs.org/docs/path-prefix/ 回答1: TL:DR pathPrefix has much more impact on your site — it add a prefix to the generated url of all your pages and assets. basePath is just a helper for generating slug from your filesystem — In my experience with Gatsby I rarely use it at all. pathPrefix It appends a prefix

Gatsby: what's the difference between basepath and path prefix?

蹲街弑〆低调 提交于 2020-02-22 08:12:08
问题 I don't understand the difference between basepath and path prefix in Gatsby , and when to use each feature Basepath: https://www.gatsbyjs.org/tutorial/part-seven/ Path prefix: https://www.gatsbyjs.org/docs/path-prefix/ 回答1: TL:DR pathPrefix has much more impact on your site — it add a prefix to the generated url of all your pages and assets. basePath is just a helper for generating slug from your filesystem — In my experience with Gatsby I rarely use it at all. pathPrefix It appends a prefix

Gatsby: what's the difference between basepath and path prefix?

拈花ヽ惹草 提交于 2020-02-22 08:12:07
问题 I don't understand the difference between basepath and path prefix in Gatsby , and when to use each feature Basepath: https://www.gatsbyjs.org/tutorial/part-seven/ Path prefix: https://www.gatsbyjs.org/docs/path-prefix/ 回答1: TL:DR pathPrefix has much more impact on your site — it add a prefix to the generated url of all your pages and assets. basePath is just a helper for generating slug from your filesystem — In my experience with Gatsby I rarely use it at all. pathPrefix It appends a prefix

Gatsby - page refresh corruption

≯℡__Kan透↙ 提交于 2020-02-22 07:56:06
问题 I have a problem with one page on my gatsby site. If I go to that page from any other then it renders fine. But if I follow a link directly to it, or refresh the page once loaded then it does not render correctly. All of the other pages render fine. The one thing different about this is the use of flex display layout. Looking at the page structure, it's rendered differently. HTML looks pretty much the same, but the classes and class attributes set by gatsy are different. This is the page in

Gatsby - page refresh corruption

不打扰是莪最后的温柔 提交于 2020-02-22 07:53:57
问题 I have a problem with one page on my gatsby site. If I go to that page from any other then it renders fine. But if I follow a link directly to it, or refresh the page once loaded then it does not render correctly. All of the other pages render fine. The one thing different about this is the use of flex display layout. Looking at the page structure, it's rendered differently. HTML looks pretty much the same, but the classes and class attributes set by gatsy are different. This is the page in

graphql: querying with dynamic filtering criteria

喜欢而已 提交于 2020-02-06 08:38:40
问题 I am trying to perform a query using the in operator where the criteria is based on values in an array. How can I perform the query below to take an array and base its in criteria off a variable array? I am using reactjs + gatsby. ... graphql` query pageHeader { .... there is another query in the real code above this line allContentInSites (filter: {slug: {in: ` + JSON.stringify(searchCriteria.map(item => item.value)) + ` }}) { edges { node { title, link } } } }' I was initially thinking the

How to get Gatsby Images based on results of PageQuery?

女生的网名这么多〃 提交于 2020-02-04 04:19:06
问题 I'd like to do something like the following so I can get Gatsby Images dynamically: const image = 'gastby-astronaut.png'; export const imageQuery = graphql` { allImageSharp ( filter: { fluid: { originalName: { regex: "/${image}/" } } } ){ edges { node { fluid { originalName } } } } } `; However, I can't figure out how to connect this query to an initial query that would get the 'gatsby-astronaut.png', or perform this query from a subcomponent with a . I get this error when I try this: Error:

Gatsby.js - 404 page for nested project

拜拜、爱过 提交于 2020-02-02 14:49:53
问题 I have a Gatsby.js project that I host through Github Pages. The project is within a directory called /an I'm deploying it through gh-pages package with the following command gatsby build --prefix-paths && gh-pages -d public -b master -e ./an I've followed https://www.gatsbyjs.org/docs/path-prefix/ to set the proper prefix path. My custom 404 page is not detected through Github Pages. I believe it is because it has to be set on the repo root and not in /an. How to tell GitHub Pages to use the