gatsby

Gatsby.js - 404 page for nested project

偶尔善良 提交于 2020-02-02 14:48:27
问题 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

Gatsby server-side rendering of page with client-only routes, based on window location

冷暖自知 提交于 2020-01-25 06:49:28
问题 I am working on a Gatsby project (a language learning blog) and am having trouble with an issue that only happens in production builds due to server-side rendering. I programmatically generate a page for each blog post with the following scheme: /posts/{post-name} . Each post can also have a number of subpaths that map to open tabs in the UI. For example, /posts/important-spanish-verbs/lesson would open the lesson tab. Each page has a matchPath property of /posts/{post-name}/* , and these are

How can I create blog entries for Gatsby with migrated HTML content

蓝咒 提交于 2020-01-24 13:52:38
问题 I am trying to migrate a blog, and can extract the posts in HTML format as well as title, keywords, data, meta description, etc. How can I use them to create the blog posts in GatsbyJS? I can only find instructions for using Markdown. It is not really feasible to migrate several hundred of this by hand and converting them to markdown because of the complex formatting along with some inline CSS styles. Is there some way of adding the HTML in a separate Javascript file so that it gets included

How can I create blog entries for Gatsby with migrated HTML content

荒凉一梦 提交于 2020-01-24 13:51:55
问题 I am trying to migrate a blog, and can extract the posts in HTML format as well as title, keywords, data, meta description, etc. How can I use them to create the blog posts in GatsbyJS? I can only find instructions for using Markdown. It is not really feasible to migrate several hundred of this by hand and converting them to markdown because of the complex formatting along with some inline CSS styles. Is there some way of adding the HTML in a separate Javascript file so that it gets included

How to add facebook comment plugin in Gatsby?

*爱你&永不变心* 提交于 2020-01-23 17:47:04
问题 I'm creating a blog site using Gatsby. I am very very new to Gatsby/React. I need some documentation about the facebook comment plugin for Gatsby. Thanks in advance. 回答1: If you mean retrieving Facebook comments using Facebook's Graph API, which provides comments, you may be able to achieve that with gatsby-source-facebook, which you can install as follows into your Gatsby site: npm install --save gatsby-source-facebook Then, configure the source plugin by adding this to gatsby-config.js :

Reusable Gatsby-Image Component with dynamic image sources

邮差的信 提交于 2020-01-22 13:29:28
问题 I’m thinking of using Gatsby-Image for my next project and has been playing around with it a little. I got it to work on my test project but then I came up with a use case that I would like to use the from Gatsby much like a regular <img src”image.png”> tag. My question is therefore how I can make the Gatsby component reusable? import React from "react" import { StaticQuery, graphql } from "gatsby" import Img from "gatsby-image" function renderImage({ file }) { console.log({ file }) return

GraphQL Inline fragments check if exist and then output in a .map

这一生的挚爱 提交于 2020-01-22 03:10:00
问题 I have a react component in gatsbyJS that is mapping through a graphQL query, so far it works however I have introduced a inline fragment in the graphQL query two of them actually and I want to check if fragment exists then output the code otherwise all my maps are outputting empty div's after real content is outputted. I didn't include the whole query or all the code for brevity. Hopefully someone can help, Thanks! Here is my map and jsx {data.datoCmsProject.projectBlock.map(projectEntry =>

Can't sort Column in Ant Design Table in Gatsby site

若如初见. 提交于 2020-01-21 09:57:46
问题 I have implement an Ant Design Table in a Gatsby site. I am pulling in the data from graphql. So far everything has worked just fine. The data is displaying properly, pagination works, etc. Now I want to add the ability to sort the columns. To do so, I set up the table and columns as follows: <Table dataSource={data.allNewsFeed.edges} onChange={onChange} rowSelection={rowSelection} rowKey="id" > <Column title="Title" dataIndex="node.title" key="title" sorter={(a, b) => a.node.title - b.node

Can't sort Column in Ant Design Table in Gatsby site

穿精又带淫゛_ 提交于 2020-01-21 09:57:26
问题 I have implement an Ant Design Table in a Gatsby site. I am pulling in the data from graphql. So far everything has worked just fine. The data is displaying properly, pagination works, etc. Now I want to add the ability to sort the columns. To do so, I set up the table and columns as follows: <Table dataSource={data.allNewsFeed.edges} onChange={onChange} rowSelection={rowSelection} rowKey="id" > <Column title="Title" dataIndex="node.title" key="title" sorter={(a, b) => a.node.title - b.node

The right way to define a sourced page as Gatsby's front page

Deadly 提交于 2020-01-15 11:28:26
问题 I created a Gatsby/React instance sourcing from a Wordpress instance. I generate pages based on the page objects that I source from Wordpress. Everything works fine. I know that I have to put my content for the route / into src/pages/index.js . What would be the correct/canonical way to define one of my sourced page routes e.g. /start as / ? Thanks in advance. 回答1: Basically you just call createPage with the path set to / . How you handle this in your CMS really depends on the structure you