[ contentful ] getContentTypes()

Example response

{
“sys”: {
“type”: “Array”
},
“total”: 3,
“skip”: 0,
“limit”: 100,
“items”: [
{
“sys”: {
“space”: {
“sys”: {
“type”: “Link”,
“linkType”: “Space”,
“id”: “mz3a2o72vk1f”
}
},
“id”: “blogPost”,
“type”: “ContentType”,
“createdAt”: “2018-08-23T07:59:33.002Z”,
“updatedAt”: “2018-08-31T03:43:56.866Z”,
“environment”: {
“sys”: {
“id”: “master”,
“type”: “Link”,
“linkType”: “Environment”
}
},
“revision”: 3
},
“displayField”: “title”,
“name”: “Blog Post”,
“description”: “”,
“fields”: [
{
“id”: “title”,
“name”: “Title”,
“type”: “Symbol”,
“localized”: true,
“required”: true,
“disabled”: false,
“omitted”: false
},
{
“id”: “slug”,
“name”: “Slug”,
“type”: “Symbol”,
“localized”: false,
“required”: true,
“disabled”: false,
“omitted”: false
},
{
“id”: “heroImage”,
“name”: “Hero Image”,
“type”: “Link”,
“localized”: false,
“required”: true,
“disabled”: false,
“omitted”: false,
“linkType”: “Asset”
},
{
“id”: “description”,
“name”: “Description”,
“type”: “Text”,
“localized”: false,
“required”: true,
“disabled”: false,
“omitted”: false
},
{
“id”: “body”,
“name”: “Body”,
“type”: “Text”,
“localized”: false,
“required”: true,
“disabled”: false,
“omitted”: false
},
{
“id”: “author”,
“name”: “Author”,
“type”: “Link”,
“localized”: false,
“required”: false,
“disabled”: false,
“omitted”: false,
“linkType”: “Entry”
},
{
“id”: “publishDate”,
“name”: “Publish Date”,
“type”: “Date”,
“localized”: false,
“required”: true,
“disabled”: false,
“omitted”: false
},
{
“id”: “tags”,
“name”: “Tags”,
“type”: “Array”,
“localized”: false,
“required”: false,
“disabled”: false,
“omitted”: false,
“items”: {
“type”: “Symbol”,
“validations”: [
{
“in”: [
“general”,
“javascript”,
“static-sites”
]
}
]
}
}
]
},
{
“sys”: {
“space”: {
“sys”: {
“type”: “Link”,
“linkType”: “Space”,
“id”: “mz3a2o72vk1f”
}
},
“id”: “person”,
“type”: “ContentType”,
“createdAt”: “2018-08-23T07:59:32.230Z”,
“updatedAt”: “2018-08-23T07:59:32.230Z”,
“environment”: {
“sys”: {
“id”: “master”,
“type”: “Link”,
“linkType”: “Environment”
}
},
“revision”: 1
},
“displayField”: “name”,
“name”: “Person”,
“description”: “”,
“fields”: [
{
“id”: “name”,
“name”: “Name”,
“type”: “Symbol”,
“localized”: false,
“required”: true,
“disabled”: false,
“omitted”: false
},
{
“id”: “title”,
“name”: “Title”,
“type”: “Symbol”,
“localized”: false,
“required”: true,
“disabled”: false,
“omitted”: false
},
{
“id”: “company”,
“name”: “Company”,
“type”: “Symbol”,
“localized”: false,
“required”: true,
“disabled”: false,
“omitted”: false
},
{
“id”: “shortBio”,
“name”: “Short Bio”,
“type”: “Text”,
“localized”: false,
“required”: true,
“disabled”: false,
“omitted”: false
},
{
“id”: “email”,
“name”: “Email”,
“type”: “Symbol”,
“localized”: false,
“required”: false,
“disabled”: false,
“omitted”: false
},
{
“id”: “phone”,
“name”: “Phone”,
“type”: “Symbol”,
“localized”: false,
“required”: false,
“disabled”: false,
“omitted”: false
},
{
“id”: “facebook”,
“name”: “Facebook”,
“type”: “Symbol”,
“localized”: false,
“required”: false,
“disabled”: false,
“omitted”: false
},
{
“id”: “twitter”,
“name”: “Twitter”,
“type”: “Symbol”,
“localized”: false,
“required”: false,
“disabled”: false,
“omitted”: false
},
{
“id”: “github”,
“name”: “Github”,
“type”: “Symbol”,
“localized”: false,
“required”: false,
“disabled”: false,
“omitted”: false
},
{
“id”: “image”,
“name”: “Image”,
“type”: “Link”,
“localized”: false,
“required”: false,
“disabled”: false,
“omitted”: false,
“linkType”: “Asset”
}
]
},
{
“sys”: {
“space”: {
“sys”: {
“type”: “Link”,
“linkType”: “Space”,
“id”: “mz3a2o72vk1f”
}
},
“id”: “testNewContentType”,
“type”: “ContentType”,
“createdAt”: “2018-08-31T09:44:15.788Z”,
“updatedAt”: “2018-08-31T09:44:15.788Z”,
“environment”: {
“sys”: {
“id”: “master”,
“type”: “Link”,
“linkType”: “Environment”
}
},
“revision”: 1
},
“displayField”: “shortText”,
“name”: “test new content type”,
“description”: “test new content type”,
“fields”: [
{
“id”: “shortText”,
“name”: “shortText”,
“type”: “Symbol”,
“localized”: false,
“required”: false,
“disabled”: false,
“omitted”: false
},
{
“id”: “longText”,
“name”: “longText”,
“type”: “Text”,
“localized”: false,
“required”: false,
“disabled”: false,
“omitted”: false
},
{
“id”: “numberInteger”,
“name”: “numberInteger”,
“type”: “Integer”,
“localized”: false,
“required”: false,
“disabled”: false,
“omitted”: false
},
{
“id”: “numberDecimal”,
“name”: “numberDecimal”,
“type”: “Number”,
“localized”: false,
“required”: false,
“disabled”: false,
“omitted”: false
},
{
“id”: “dateAndTime”,
“name”: “dateAndTime”,
“type”: “Date”,
“localized”: false,
“required”: false,
“disabled”: false,
“omitted”: false
},
{
“id”: “location”,
“name”: “location”,
“type”: “Location”,
“localized”: false,
“required”: false,
“disabled”: false,
“omitted”: false
},
{
“id”: “boolean”,
“name”: “boolean”,
“type”: “Boolean”,
“localized”: false,
“required”: false,
“disabled”: false,
“omitted”: false
},
{
“id”: “mediaOneFile”,
“name”: “mediaOneFile”,
“type”: “Link”,
“localized”: false,
“required”: false,
“disabled”: false,
“omitted”: false,
“linkType”: “Asset”
},
{
“id”: “mediaManyFiles”,
“name”: “mediaManyFiles”,
“type”: “Array”,
“localized”: false,
“required”: false,
“disabled”: false,
“omitted”: false,
“items”: {
“type”: “Link”,
“validations”: [],
“linkType”: “Asset”
}
},
{
“id”: “referenceOneReference”,
“name”: “referenceOneReference”,
“type”: “Link”,
“localized”: false,
“required”: false,
“disabled”: false,
“omitted”: false,
“linkType”: “Entry”
},
{
“id”: “referenceManyReference”,
“name”: “referenceManyReference”,
“type”: “Array”,
“localized”: false,
“required”: false,
“disabled”: false,
“omitted”: false,
“items”: {
“type”: “Link”,
“validations”: [],
“linkType”: “Entry”
}
},
{
“id”: “jsonObject”,
“name”: “jsonObject”,
“type”: “Object”,
“localized”: false,
“required”: false,
“disabled”: false,
“omitted”: false
}
]
}
]
}

ref : https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/content-types/content-type/get-a-single-content-type/console/js

[ gatsby-transformer-json ] queries

gatsby-config.json

‘gatsby-transformer-json’,
{
resolve: ‘gatsby-source-filesystem’,
options: {
path: ‘./export/entries.json’,
},
},

./export/entries.json

[
{
“sys”: {

“id”: “3K9b0esdy0q0yGqgW2g6Ke”,

}

}

]

pong NOTE : the file name should end with Json.

graphql query

{
allEntriesJson {
edges {
node {
sys {
id
}
}
}
}
}

ref : https://www.gatsbyjs.org/packages/gatsby-transformer-json

[ gatsby ] Error: Cannot find module ‘gatsby/graphql’

Problem

$ gatsby build
success delete html and css files from previous builds — 0.036 s
success open and validate gatsby-config — 0.009 s
success copy gatsby files — 0.025 s
error UNHANDLED EXCEPTION
Error: Cannot find module 'gatsby/graphql'

- v8-compile-cache.js:159 require
[contentful-gatsby-blog]/[v8-compile-cache]/v8-compile-cach e.js:159:20

- extend-file-node.js:3 Object.
[contentful-gatsby-blog]/[gatsby-source-filesystem]/extend- file-node.js:3:18

- v8-compile-cache.js:178 Module._compile
[contentful-gatsby-blog]/[v8-compile-cache]/v8-compile-cach e.js:178:30

- v8-compile-cache.js:159 require
[contentful-gatsby-blog]/[v8-compile-cache]/v8-compile-cach e.js:159:20

- gatsby-node.js:172 Object.
[contentful-gatsby-blog]/[gatsby-source-filesystem]/gatsby- node.js:172:38

- v8-compile-cache.js:178 Module._compile
[contentful-gatsby-blog]/[v8-compile-cache]/v8-compile-cach e.js:178:30

- module.js:11 require
internal/module.js:11:18

- api-runner-node.js:87 runAPI
[contentful-gatsby-blog]/[gatsby]/dist/utils/api-runner-nod e.js:87:20

- api-runner-node.js:187
[contentful-gatsby-blog]/[gatsby]/dist/utils/api-runner-nod e.js:187:33

Solution

install v1 instead of v2

npm install --save gatsby-source-filesystem@1.5.39
npm install gatsby-transformer-json@1.0.20

ref : https://github.com/gatsbyjs/gatsby/issues/6560

[ gatsby ] graphql query all site page

query all sites page

{
allSitePage {
edges {
node {
path
component
pluginCreator {
name
pluginFilepath
}
}
}
}
}

query all category

{
allContentfulCategory {
edges {
node {
title
slug
}
}
}
}

query all blogpost

{
allContentfulBlogPost {
edges {
node {
title
}
}
}
}

ref : https://www.gatsbyjs.org/docs/creating-and-modifying-pages/

[ vagrant ] Vagrant was unable to mount VirtualBox shared folders. This is usually because the filesystem “vboxsf” is not available. This filesystem is made available via the VirtualBox Guest Additions and kernel module. Please verify that these guest additions are properly installed in the guest. This is not a bug in Vagrant and is usually caused by a faulty Vagrant box. For context, the command attempted was: mount -t vboxsf -o dmode=777,fmode=666,uid=1000,gid=1000 var_www /var/www The error output from the command was: : No such device

Problem

Vagrant was unable to mount VirtualBox shared folders. This is usually because the filesystem "vboxsf" is not available. This filesystem is made available via the VirtualBox Guest Additions and kernel module. Please verify that these guest additions are properly installed in the guest. This is not a bug in Vagrant and is usually caused by a faulty Vagrant box. For context, the command attempted was: mount -t vboxsf -o dmode=777,fmode=666,uid=1000,gid=1000 var_www /var/www The error output from the command was: : No such device

Solution

vagrant plugin install vagrant-vbguest

vagrant reload

ref : https://stackoverflow.com/questions/43492322/vagrant-was-unable-to-mount-virtualbox-shared-folders