@content-app/core
TypeScript icon, indicating that this package has built-in type declarations

0.3.0 • Public • Published

content-app/core

Logo

Build your website with contentful.


Install

npm i @content-app/core

Model

Content model

API

createCoreModels(client: ClientAPI, options: Options)

This function creates the content types in your space.

import contentful from 'contentful-management';

(async () => { 
const client = contentful.createClient({
    accessToken: 'YOUR_ACCESS_TOKEN',
})

await createCoreModels(client, {
    spaceId: 'YOUR_SPACE_ID',
    environment: 'YOUR_ENVIRONMENT',
});
})();

Modules

There are 3 types of modules

  • RouteModule: to extend routes
  • PageModule: Load your own page content
  • ContentModule: Load your own content

Content Modules

There are several ways to hook into the system. For example, you might want to implement a module that installs one or more content types, or you may want to add more pages, or you may want to add more data. Even though there will be a page for every page contentype, there could be cases when you want to add your own.

Add your own content types

If you want to use this feature you need to install the cli https://github.com/content-app/cli.

  • First you need to install the module via npm. For example: npm install module-content-stage
  • Then you can use the command content-app load-content-module <contentModule>.
  • This command will look after this file in the current path: node_modules/@content-app/content-module_${contentModule}/install.js
  • The command will then import the exported function and call it with following arguments: client, space, environment

So your install.js might start like this.

module.exports = async function({ client, space, environment }) {
     const myEntry = await environment.createContentTypeWithId({... your configs}, 'MyContentypeId');
     await myEntry.publish();
};

Readme

Keywords

none

Package Sidebar

Install

npm i @content-app/core

Weekly Downloads

1

Version

0.3.0

License

MIT

Unpacked Size

236 kB

Total Files

54

Last publish

Collaborators

  • janmarkuslanger