contentful

Gatsby.js: Filter GraphQL query by nested object property

Deadly 提交于 2019-12-05 10:34:34
I'm working on a news site which will have articles, each with one or multiple respective authors. If you click on an author's name, it will take you to a page displaying their information and a list of articles they have contributed to. So each article has an authors property, which in turn is an array of author objects with properties: full name, slug ( lowercase version of full name with spaces replaced by dashes ), etc. Is it possible to filter the articles by a particular author's slug when defining the query? query authorQuery($slug: String!) { allContentfulArticle(filter: { //not sure

Programmatically create Gatsby pages from Contentful data

与世无争的帅哥 提交于 2019-12-05 07:42:12
I am looking for help with GatsbyJS and Contentful. The docs aren't quite giving me enough info. I am looking to programmatically create pages based on contentful data. In this case, the data type is a retail "Store" with a gatsby page at /retail_store_name The index.js for each store is basically a couple of react components with props passed in e.g. shop name and google place ID. Add data to contentful. Here is my example data model: { "name": "Store" "displayField": "shopName", "fields": [ { "id": "shopName", "name": "Shop Name", "type": "Symbol", "localized": false, "required": true,

How to handle Contentful content data in Gatsby

試著忘記壹切 提交于 2019-12-05 05:32:20
I'm interested in using Gatsby to build a Netlify static site using content from Contentful Netlify has this nice gettting started Gatsby guide: ​​ https://www.netlify.com/blog/2016/02/24/a-step-by-step-guide-gatsby-on-netlify But I'm a bit unsure of how to bring Contentful into the mix. Do I need to write scripts to convert my Contentful content into Gatsby 'markdown'? Any ideas, ideas, links appreciated! Brandon Since this question was posted, an official Contentful plugin's been added to Gatsby's collection (official as in created by Gatsby team, not Contentful): https://github.com/gatsbyjs

contentful api markdown conversion to HTML

给你一囗甜甜゛ 提交于 2019-12-05 00:32:32
Is there any simple way to convert markdown text from contentful api to render into html code to be display on html page. I have tried using pagedown and some similar techniques , but none seem to work for me . I'm a customer success manager at Contentful - You can check out a list of recommended parsers by language on the our FAQ . Also, feel free to send us messages on Intercom via our UI by clicking the 'Talk to Us' link :) I know I'm late but here's the solution using handlebars: var marked = require('marked'); marked.setOptions({ renderer: new marked.Renderer(), sanitize: true, smartLists

GraphQL queries for Gatsby - Contentful setup with a flexible content model

自古美人都是妖i 提交于 2019-12-03 09:32:28
I have a gatsby site with the contentful plugin and graphql queries (setup is working). [EDIT] My gatsby setup pulls data dynamically using the pageCreate feature. And populates my template component, the root graphql query of which I've shared below. I can create multiple pages using the setup if the pages on contentful follow the structure given in the below query. [/EDIT] My question is about a limitation I seemed to have come across or just don't know enough grpahql to understand this yet. My high level content model 'BasicPageLayout' consists of references to other content types through