Characteristics of File Structure

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

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

It is recommended to start the service and perform site wholly building once, so that you can clearly see the file structure of Cabloy-CMS

Root Directory

  • development environment: the CMS root directory is located inside the source code project for easily debugging
  • production environment: the source code project may be read-only, so the CMS root directory is placed in the current user’s home directory by default
Name Environment Value
Root Directory Development {ProjectDir}/src/backend/app/public/{InstanceId}/cms
Root Directory Production {HomeDir}/cabloy/{ProjectName}/public/{InstanceId}/cms
  • InstanceId: Instance Id, multi-instance can be used to build multiple CMS sites
  • HomeDir: The default is the current user’s Home directory

The configuration of module a-base can be changed in the project’s config file:

src/backend/config/config.prod.js

config.modules = {
  'a-base': {
    publicDir: '/path/to/public',
  },
};
  • publicDir: must be an absolute path, equivalent to overwriting the path in the production environment: {HomeDir}/cabloy/{ProjectName}/public, then the root directory will be: {publicDir}/{InstanceId}/cms

Primary Directory

1

Name Description
dist output directory for build
en-us/zh-cn source code directory for language

Output Directory

2

Name Description Rendering Timing Remark
articles all rendered article pages 1 & 2
assets resource files 1
plugins plugin resource files 1
static static files 1 for example, the file articles.html, load articles by performing the backend API with ajax, thereby implements category, tag, search and other features concentratedly
zh-cn output directory of other language
index.html home page 1 & 2 because the home page may contain recently published articles, when article separately rendering, the home page will be rendered again in order to improve the home page access performance
robots.txt SEO file 1
sitemap.xml SEO file 1 site map file for the current language, modified when article separately rendering
sitemapindex.xml SEO file 1 site map file index
  • 1: site wholly building
  • 2: article separately rendering

Language Source Directory

3

Name Description Remark
intermediate intermediate files directory When site wholly building, all source files and resources of the theme, plugins, and custom source files are uniformly written to the intermediate directory
custom custom source directory you can add custom source files in the custom directory. When site wholly building, the custom files 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 file can be placed in this directory in order to be written to the dist directory when site wholly building
Name Description Remark
assets resource files
layout layout directory you can plan and add page elements according to your own needs
main main rendering template directory
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 file in this directory when you need to render the home page. Why is directory? In a complex site, you can have multiple home page templates depending on the scenario
plugins plugin resource directory when site wholly building, all plugin source files and resources are written to the plugins directory
static static file directory for example, the file articles.html, load articles by performing the backend API with ajax, thereby implements category, tag, search and other features concentratedly

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

  • Uniformly write to the same directory to facilitate inclusion references between files when rendering