{"id":16525549,"url":"https://github.com/andrewn/gatsby-plugin-cockpit-temp","last_synced_at":"2025-07-19T07:04:44.883Z","repository":{"id":66464776,"uuid":"143448921","full_name":"andrewn/gatsby-plugin-cockpit-temp","owner":"andrewn","description":"Fork of ginetta/ginetta-gatsby-source-plugin with support for gatsby 2.0","archived":false,"fork":false,"pushed_at":"2018-11-09T16:21:36.000Z","size":162,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-03T02:24:53.938Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://github.com/ginetta/ginetta-gatsby-source-plugin/tree/master/gatsby-plugin-cockpit","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andrewn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-08-03T16:17:33.000Z","updated_at":"2019-04-04T14:14:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"5eb137d9-2ca0-414d-80bc-6e102825af47","html_url":"https://github.com/andrewn/gatsby-plugin-cockpit-temp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/andrewn/gatsby-plugin-cockpit-temp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewn%2Fgatsby-plugin-cockpit-temp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewn%2Fgatsby-plugin-cockpit-temp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewn%2Fgatsby-plugin-cockpit-temp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewn%2Fgatsby-plugin-cockpit-temp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andrewn","download_url":"https://codeload.github.com/andrewn/gatsby-plugin-cockpit-temp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewn%2Fgatsby-plugin-cockpit-temp/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265899834,"owners_count":23845876,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-11T17:04:00.087Z","updated_at":"2025-07-19T07:04:44.830Z","avatar_url":"https://github.com/andrewn.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gatsby-plugin-cockpit\n\nThis source plugin pulls [Cockpit Headless CMS](https://getcockpit.com) data to a[GatsbyJS](https://www.gatsbyjs.org), a static site generator for React.\n\n## Resources\n\n+ **[Example project](https://github.com/pierreberchtold/gatsby-cockpit-portfolio)**: a simple portfolio with pages and projects\n+ **[Getting started article](https://blog.ginetta.net/getting-started-with-gatsby-and-cockpit-part-1-of-2-d86871932d44)**: an introduction based on the example project.\n\n## Install\n\n`npm install --save gatsby-plugin-cockpit`\n\n##How to use\n\nAdd the following to `gatsby-config.js`\n\n```\n  plugins: [\n    {\n      resolve: `gatsby-source-filesystem`,\n      options: {\n        name: `src`,\n        path: `${__dirname}/src/`,\n      },\n    },\n    {\n      resolve: 'gatsby-plugin-cockpit',\n      options: {\n        cockpitConfig: {\n          baseURL: 'http://localhost:8888',\n          folder: '/cockpit',\n          accessToken: '4d659efb084077fd24aeb4871d4386',\n          collections: ['posts'],\n          regions: ['footer'],\n          customComponents: [],\n        },\n      },\n    },\n  ],\n```\n\n### Options\n\n| Option               |            | Default | Description                                                  |\n| -------------------- | ---------- | ------- | ------------------------------------------------------------ |\n| **baseURL**          | *required* | *none*  | The url to you Cockpit installation                          |\n| **folder**           | *optional* | *''*    | The folder of your Cockpit installation                      |\n| **accessToken**      | *required* | *none*  | A valid API access token to you cockpit installation. See the [Cockpit Documentation](https://getcockpit.com/documentation/api/token) |\n| **collections**      | *optional* | *[]*    | The specific Cockpit collections you want to fetch. If empty all collections will be fetched. |\n| **regions**          | *optional* | *[]*    | The specific Cockpit regions you want to fetch. If empty all regions will be fetched. |\n| **customComponents** | *optional* | *[]*    | If you have defined some custom components for you cockpit layout fields and want them to be parsed for image fields. |\n\n## How to Query\n\nYou can query *collections*, *regions* and *assets*.\n\n### Query Collections\n\nCollections are converted into nodes. For example a `posts` collections is transformed into `post` nodes. So you can you `allPost` and `post` in your GraphQL queries.\n\n```graphql\nallPost {\n    edges {\n        nodes {\n            id\n            ...\n        }\n    }\n}\n```\n\n### Query Assets\n\nAssets are converted into Gatsby filesystem files and can be fetched with `allFile` or `file`.\n\n```\nallFile {\n    edges {\n        nodes {\n            id\n            publicURL\n            ...\n        }\n    }\n}\n```\n\n### Query Regions\n\nRegions are available in GraphQL as region nodes. So if you have a `footer` region in Cockpit with a *col1* and a *col2* field you can use following GraphQL query:\n\n```\nfooter: region(name: { eq: \"footer\" }) {\n\tvalues {\n\t\tcol1\n\t\tcol2\n\t}\n}\n```\n\n# Query Child Nodes From Cockpit Fields\n\nThe Gatsby **CollectionLink,**  **Asset** and **Image** fields will be parsed and transform into corresponding GraphQL nodes.\n\n### CollectionLink Field\n\nThe CollectionLink field links a collection to another collection. Here an example with `players` and `teams` collections.\n\n```\nallPlayer {\n\tedges {\n        nodes {\n            name\n            role\n            team {\n                name\n            }            \n        }\n\t}\n}\n```\n\n###Asset Field\n\nThe asset field gets extended with a `localFile` attribute linking to the corresponding file node. \n\nFor example, if you have a `candidates` collection with a name and a pdf as an asset field. So You can get the PDF URL with following GraphQL query:\n\n```\nallCandidate {\n\tedges {\n        nodes {\n            name\n            pdf {\n            \tlocalFile {\n\t                publicURL                    \n            \t}\n            }            \n        }\n\t}\n}\n```\n\n### Image Field\n\nLike the asset field, the image field gets extended with a `localFile` attribute linking to the corresponding file node. \n\nGiven a `post` collection with title, content and preview. You can use [`gatsby-image` plugin](https://www.gatsbyjs.org/packages/gatsby-image/) in your GraphQL query and take advantage of Gatsby's image processing features.\n\n```\nallPost {\n\tedges {\n        nodes {\n            title\n            content\n            preview {\n            \tlocalFile {\n                    childImageSharp {\n                        sizes(maxWidth: 2000, quality: 90) {\n                            ...GatsbyImageSharpSizes_withWebp\n                        }\n                    }                    \n            \t}\n            }            \n        }\n\t}\n}\n```\n### Layout Field\n\nThe layout field enables us to visually arrange components. It is even possible to define custom components corresponding to React Components we will us in Gatsby. This may be done with the [LayoutComponents addon](https://github.com/agentejo/LayoutComponents).\n\nGiven a `page` collection with title and content. You can do the following query:\n\n```\nallPage {\n\tedges {\n        nodes {\n            title\n            content {\n            \tcomponent\n\t\t        settings {\n                    # component fields\n                    ...\n\t\t        }\n            }    \n            content_parsed\n            content_files {\n                id\n                publicURL\n                # normal file node\n            }\n        }\n\t}\n}\n```\n\n- ***fieldname*** gives you the components with their settings\n- ***fieldname*_parsed** gives you the the same than field name but in an object. It enables you to ignore the type of components in the query and just getting all the component settings.\n- ***fieldname*_files** gives you all the file nodes present in the layout.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewn%2Fgatsby-plugin-cockpit-temp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandrewn%2Fgatsby-plugin-cockpit-temp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewn%2Fgatsby-plugin-cockpit-temp/lists"}