Javascript 盖茨比动态内容与模式拼接
我有下面的graphql查询,它是在构建时从我的gatsby-node.js文件执行的,我用它来引入我的文章数据。有没有一种方法可以使用Apollo/Axios来检索新文章,而不必在构建之间重新构建站点,实际上是重新水化我的站点?非常感谢您的帮助 我使用gatsbyv2,Drupal作为我的CMS和GraphQLJavascript 盖茨比动态内容与模式拼接,javascript,reactjs,gatsby,Javascript,Reactjs,Gatsby,我有下面的graphql查询,它是在构建时从我的gatsby-node.js文件执行的,我用它来引入我的文章数据。有没有一种方法可以使用Apollo/Axios来检索新文章,而不必在构建之间重新构建站点,实际上是重新水化我的站点?非常感谢您的帮助 我使用gatsbyv2,Drupal作为我的CMS和GraphQL exports.createPages = ({ graphql, actions }) => { const { createPage } = actions; con
exports.createPages = ({ graphql, actions }) => {
const { createPage } = actions;
const blogTemplate = path.resolve('src/templates/blog-post.js');
return graphql(`
{
blog: allNodeArticle{
edges {
node {
id
path {
alias
}
}
}
}
`
).then(result => {
if (result.errors) {
Promise.reject(result.errors);
}
// Create blog pages
result.data.blog.edges.forEach(({ node }) => {
createPage({
path: node.path.alias,
component: blogTemplate,
context: {
alias: node.path.alias,
},
});
});
});
}
我希望在新数据可用时将其合并,同时保持旧数据完全静态(盖茨比的巨大优势)