datacat-cms
Datacat Static CMS
Last updated 3 years ago by christiaan.maks .
MIT · Original npm · Tarball · package.json
$ cnpm install datacat-cms 
SYNC missed versions from official npm registry.

Installation

npm install datacat-cms

Requirements

VueJS 2.x

Add this code to these files

build/build.js

const indexer = require('datacat-cms/build')
indexer.indexFiles()
indexer.indexContent()

src/main.js

require('datacat-cms/admin')

And to load content for displaying:

store.commit('content/loadConfig')
store.commit('content/loadContent')

App.vue

Replace #app with:

#app(v-if='$route.path.indexOf("/admin") !== 0')

index.html

    <div id="admin"></div>

below the app tag.

router/index.js

    {
      path: '/admin',
      beforeEnter: (to, from, next) => {
        if (from.matched.length > 0) { // experimental fix for multi routers
          next()
          return location.reload()
        }

        next()
      }
    },

Before your 404 route. This is experimental for now.

Content

Add a content folder to your project root.

Inside this new folder, add config.json with these defaults:

{
  "upload_folder": "static/content",
  "contenttypes": [
    "blogpost"
  ]
}

And since we have now defined a content type named blogpost, add a blogpost folder inside the content folder. Here is an example for it:

{
  "name": "blogpost",
  "create": true,
  "fields": [
    {
      "name": "slug",
      "type": "hidden",
      "required": true
    },
    {
      "name": "draft",
      "type": "boolean",
      "label": "Draft (drafts are not published)",
      "default": true
    },
    {
      "name": "title",
      "type": "string",
      "label": "Title",
      "required": true,
      "overviewShow": true
    },
    {
      "name": "subtitle",
      "type": "string",
      "label": "Subtitle",
      "default": "default subtitle"
    },
    {
      "name": "readtime_minutes",
      "type": "number",
      "label": "Read time (in minutes)"
    },
    {
      "name": "publishdate",
      "type": "date",
      "label": "Publish Date",
      "overviewShow": true
    },
    {
      "name": "body",
      "type": "markdown",
      "label": "Body",
      "required": true,
      "overviewShow": true
    },
    {
      "name": "tags",
      "type": "array",
      "arraytype": "string",
      "label": "Tags",
      "default": [123, 4]
    }
  ]
}

overviewShow means that the specified field will be used in the overview list preview.

And to prevent _content.json and _files.json to get added to git, .gitignore them:

content/_content.json
content/_files.json

VueX

To use the content, add the datacat client module to your VueX instance:

import content from 'datacat-cms/client'

Auth0

Datacat uses auth0 for authentication. You must set your domain and client id in the config/settings.json file:

{
  "auth0": {
    "domain": "my.auth0.domain",
    "clientId" "client-id"
  }
}


# Improvements

So yea obviously this is alot of work, but this is a very early version of this system.

Current Tags

  • 0.1.29                                ...           latest (3 years ago)

29 Versions

  • 0.1.29                                ...           3 years ago
  • 0.1.28                                ...           3 years ago
  • 0.1.27                                ...           3 years ago
  • 0.1.26                                ...           3 years ago
  • 0.1.25                                ...           3 years ago
  • 0.1.24                                ...           3 years ago
  • 0.1.23                                ...           3 years ago
  • 0.1.22                                ...           3 years ago
  • 0.1.21                                ...           3 years ago
  • 0.1.20                                ...           3 years ago
  • 0.1.19                                ...           3 years ago
  • 0.1.18                                ...           3 years ago
  • 0.1.17                                ...           3 years ago
  • 0.1.16                                ...           3 years ago
  • 0.1.15                                ...           3 years ago
  • 0.1.14                                ...           3 years ago
  • 0.1.13                                ...           3 years ago
  • 0.1.12                                ...           3 years ago
  • 0.1.11                                ...           3 years ago
  • 0.1.10                                ...           3 years ago
  • 0.1.9                                ...           3 years ago
  • 0.1.8                                ...           3 years ago
  • 0.1.7                                ...           3 years ago
  • 0.1.6                                ...           3 years ago
  • 0.1.5                                ...           3 years ago
  • 0.1.4                                ...           3 years ago
  • 0.1.3                                ...           3 years ago
  • 0.1.2                                ...           3 years ago
  • 0.1.0                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 1
Last Month 1
Dependencies (12)
Dependents (1)

Copyright 2014 - 2016 © taobao.org |