mecha-cms / mecha

Minimalist content management system.

Home Page:https://mecha-cms.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Structures

taufik-nurrohman opened this issue · comments

Draft

Region

Shield

  • shield.before
  • shield.after
  • shield.lot
  • shield.chunk.before
  • shield.chunk.after
  • shield.chunk.lot
  • shield.input
  • shield.output
  • shield.chunk.input
  • shield.chunk.output

Post

Possible format:

// parent id, id, kind(s), slug, state
2015-04-21-14-12-32.2014-11-11-16-04-14.1-2-3-16.lorem-ipsum.post → published
2015-04-21-14-12-32.2014-11-11-16-04-14.1-2-3-16.lorem-ipsum.draft → drafted
2015-04-21-14-12-32.2014-11-11-16-04-14.1-2-3-16.lorem-ipsum.archive → archived
  • post.input
  • post.output
  • post.title
  • post.description
  • post.type
  • post.author
  • post.link
  • post.url
  • post.path
  • post.date
  • post.id
  • post.parent.id
  • post.kind
  • post.slug
  • post.role
  • post.state
  • post.content
  • post.excerpt
  • post.tags
  • post.fields
  • post.fields.link

Structure:

{
  "title": "",
  "description": "",
  "type": "",
  "author": "@ta.tau.taufik",
  "link": "",
  "url": "",
  "path": "",
  "date": {
    "year": 0,
    "month": 0,
    "day": 0,
    "hour": 0,
    "minute": 0,
    "second": 0,
    "F1": 0,
    "F2": 0,
    "F3": 0
  },
  "id": 0123456789,
  "parent": {
    "id": 0123456789
  },
  "time": 0,
  "kind": [],
  "slug": "lorem-ipsum",
  "role": "",
  "state": "post",
  "content": "",
  "excerpt": "",
  "tags": [
  
  ],
  "fields": {
    "link": "http://example.com"
  }
}

Response

Possible format:

// parent id, id, kind(s), slug, state
2015-04-21-14-12-32.2014-11-11-16-04-14.1-2-3-16.lorem-ipsum.post → accepted
2015-04-21-14-12-32.2014-11-11-16-04-14.1-2-3-16.lorem-ipsum.draft → on hold
2015-04-21-14-12-32.2014-11-11-16-04-14.1-2-3-16.lorem-ipsum.archive → archived
  • response.input
  • response.output
  • response.author
  • response.email
  • response.type
  • response.link → external link to author’s website
  • response.url → should be the permanent link
  • response.path
  • response.date
  • response.id
  • response.parent.id
  • response.kind
  • response.slug
  • response.role
  • response.state
  • response.content
  • response.excerpt
  • response.tags
  • response.fields
  • response.fields.link

Structure:

{
  "author": "@ta.tau.taufik",
  "description": "",
  "type": "",
  "link": "",
  "url": "",
  "path": "",
  "date": {
    "year": 0,
    "month": 0,
    "day": 0,
    "hour": 0,
    "minute": 0,
    "second": 0,
    "F1": 0,
    "F2": 0,
    "F3": 0
  },
  "id": 0123456789,
  "parent": {
    "id": 0123456789
  },
  "time": 0,
  "kind": [],
  "slug": "lorem-ipsum",
  "role": "",
  "state": "post",
  "content": "",
  "excerpt": "",
  "tags": [
  
  ],
  "fields": {
    "link": "http://example.com"
  }
}

Nope! 👎

Page

A page file is a plain text file stored in the lot\page folder named as *.page where * is the page slug.

lot\
 └── page\
     ├── lorem-ipsum.page
     ├── dolor-sit-amet.page
     └── no-no-no.page

page is the default file extension to indicate that the file is a page file; a published page file. There are also some other page extensions that can be used:

  • page → published, indexed
  • archive → published, not indexed (not visible in the page list, and optionally by the search engine)
  • draft → not published, not indexed, not visible

If you have to translate them into numbers, then:

0: draft
1: page
2: archive

To read lot\page\lorem-ipsum.page from the site, visit http://localhost/lorem-ipsum.

A minimal page file data consists of a text. Any text. With optional headers data written in a flat YAML syntax:

---
title: Page Title
description: Page description goes here.
type: HTML
...

<p>This page data is valid.</p>
<p>This page data is also valid.</p>

Any missing header data will be replaced by default data generated by the engine. Let’s say that the default data will be loaded at first, then they are replaced by the real data from the page.

Most of the default data are just an empty string or null, which can also be translated into false in most cases.

[
    'title' => "",
    'description' => "",
    'author' => 'Taufik Nurrohman',
    'type' => 'HTML',
    'link' => null,
    'content' => "",
    'time' => File::T($path), // current file modification time will becomes the page date by default
    'update' => File::T($path),
    'kind' => [0], // default is `untagged`
    'slug' => '--',
    'state' => 'page'
]

A page file can also has a connection with a folder that is located in the same directory level, by setting the folder name with the same name as the page name, without the file extension (the page state).

lot\
 └── page\
     ├── lorem-ipsum\
     ├── lorem-ipsum.page
     ├── dolor-sit-amet.page
     └── no-no-no.page

Users can store their miscellaneous data that has relationship with the page file in that folder with extension .data. This is called Field.

Field

Field has a higher priority than the page headers. So, if you have a title.data stored in lot\page\lorem-ipsum folder, then the content of that file will overrides the title data from the page header.

lot\
 └── page\
     ├── lorem-ipsum\
     │   ├── title.data
     │   ├── description.data
     │   └── author.data
     ├── lorem-ipsum.page
     ├── dolor-sit-amet.page
     └── no-no-no.page

Users can also put another page file in that folder. This is called Page Children.

Page Children

Page Children will overrides the item page view of the current file that has relationship with the current folder, the lot\lorem-ipsum.page file, and will replace that item page view into an index page view, contains list of lot\lorem-ipsum page children.

lot\
 └── page\
     ├── lorem-ipsum\
     │   ├── title.data
     │   ├── description.data
     │   ├── author.data
     │   ├── lorem-ipsum-child-1.page
     │   ├── lorem-ipsum-child-2.page
     │   └── lorem-ipsum-child-3.page
     ├── lorem-ipsum.page
     ├── dolor-sit-amet.page
     └── no-no-no.page

And so on…

lot\
 └── page\
     ├── lorem-ipsum\
     │   ├── lorem-ipsum-child-1\
     │   │   ├── title.data
     │   │   ├── description.data
     │   │   ├── author.data
     │   │   ├── lorem-ipsum-child-child-1.page
     │   │   ├── lorem-ipsum-child-child-2.page
     │   │   └── lorem-ipsum-child-child-3.page
     │   ├── title.data
     │   ├── description.data
     │   ├── author.data
     │   ├── lorem-ipsum-child-1.page
     │   ├── lorem-ipsum-child-2.page
     │   └── lorem-ipsum-child-3.page
     ├── lorem-ipsum.page
     ├── dolor-sit-amet.page
     └── no-no-no.page