Cabloy-CMS uses a fine file structure that brings the following conveniences:

  • Easy to customize CSS, JS
  • Easy to customize static resources such as pictures, etc.
  • Easy to implement multiple language
  • Easy to debug and release

It is recommended to run the service first and build it once, so that you can clearly see the file structure of Cabloy-CMS.

Root directory

In the development environment, the CMS file root directory is located inside the source code project for easily debugging. In the production environment, the source code project may be read-only, so the CMS file root directory is placed in the current user’s home directory by default.

Development environment

Root directory: [ProjectDir]/src/backend/app/public/[InstanceId]/cms

  • InstanceId: Instance Id, multi-instance can be used to build multiple CMS sites

Production environment

Root directory: [HomeDir]/cabloy/[ProjectName]/public/[InstanceId]/cms

  • HomeDir: The default is the current user’s Home directory, which can be configured through the module a-base.

src/backend/config/config.prod.js

config.modules = {
  'a-base': {
    publicDir: 'CustomDir',
  },
};

Primary directory

WechatIMG705

Name Instruction
dist Output directory of Build
en-us/zh-cn language source directory

Output directory

WechatIMG706

Name Instruction Rendering timing Remarks
articles Store all rendered article pages One-time build
assets Resource files One-time build
plugins Plugin resource files One-time build
static Static files One-time build For example, the file articles.html, gets articles by calling the backend API with ajax, thereby implements directory, tag, search and other functions concentratedly
index.html Homepage Two rendering timing In order to improve the homepage loading performance, the homepage may contain recently published articles. So, when the article is rendered separately, the homepage will be rendered again
robots.txt SEO related One-time build Only one robots.txt is in the root directory regardless of whether there are multiple languages
sitemap.xml SEO related, site map file for the current language One-time build, modify content when the article is rendered separately
sitemapindex.xml SEO related, site map file index One-time build Only one sitemapindex.xml is in the root directory regardless of whether there are multiple languages

Language source directory

WechatIMG707

Name Instruction Remarks
intermediate Intermediate files directory When one-time build is under way, all source files and resources of the theme, plugins, and custom source code are uniformly written to the intermediate directory, and then the rendering logic is executed.
custom Custom source directory Users can add custom source files in the custom directory. When one-time build is executing, they will automatically overwrite the files of the same path in intermediate.
custom/dist Special output directory In the production environment, some third-party files such as Google site verification files can be placed in this directory for output in one-time build
Name Instruction Rendering timing Remarks
assets Resource files One-time build
layout Layout directory Intermediate file The layout is not an officially mandated directory. The theme can be added according to your needs, and you could planning your own page elements as well
main Main rendering template directory Two rendering timings
main/article.ejs Article rendering template Use this template file when you need to render an article
main/index Home page rendering template directory Use the template files in this directory when you need to render the home page. Why is directory? In a complex site, you can have multiple classes of home page templates depending on the scenario.
plugins Plugin directory One-time build In one-time build, all plugin source files and resources are written to the plugins directory
static Static file directory One-time build For example, the file articles.ejs, gets articles by calling the backend API with ajax, thereby implements directory, tag, search and other functions concentratedly

Why to write all source files (themes, plugins, custom sources) to the intermediate directory?

  • Write to the same directory to facilitate inclusion references between files