cPageBuild is a static site generator (SSG) that uses the C preprocessor as back-end. This website has been generated with cPageBuild. The release includes sources and manual as ZIP file (100 kB):
For details on how to use cPagebuild, see the cPageBuild manual.
cPageBuild may be suited for you if:
- You are a C/C++ developer and familiar with the C preprocessor.
- You want to write a static website pretty directly in HTML.
You can pull out repetitive items like header, menu, and footer into include files of their own, and you can define building blocks via macros. cPageBuild will help you to get string concatenation and whitespace control.
- Everything that the C preprocessor supports
- Custom escape sequences for whitespace and string control
- Optional HTML minification
- XML sitemap generation
- Support for nested directories
- Multi-threaded builds: 85k pages per minute with 8 threads
- Incremental builds: 600 ms for 90k unchanged pages.
- No layout templates available
- No markdown
- No pagination
- No categories or tags
- No automatic syntax highlighting
- Preformatted text needs hacks.
cPageBuild is intended to run locally on the development machine with the resulting HTML pages being uploaded to the web server. However, you can also run cPageBuild directly on the server side.
- macOS (probably).
You need a C compiler both for installation and operation. So far, only GCC has been tested (Mingw-w64 under Windows). The C compiler may be in the system’s search path, or you can instead configure the path directly in the shell scripts resp. batch files.
For generating the cPageBuild executable, make is required under Linux while it is optional under Windows.
The cPageBuild executable will be put in the project bin directory.
Linux: Run make in the project directory.
Windows: If make is installed, run make in the project directory. Otherwise, open make_cpagebuild.bat in an editor, put in the C compiler path at the top of the script, and run the batch file.
Running the tests
After generating the executable, go to the tests directory. Open run_tests.sh (Linux) or run_tests.bat (Windows) in an editor. Put in the C compiler path at the top of the script.
Then run the script either from the command line or from an explorer. It is normal that one missing file is reported, this is part of the test. The result should read “Passed: all”.
In the demo directory, you will find a small website consisting of four pages. It shows how to use defines, includes, and ifdefs to create a page template. There is also an example how to use advanced macros with string concatenation and how to deal with preformatted text.
cPageBuild is licenced under the GNU General Public License (GPL) Version 3 or later. The download archive contains a copy of the full GPL text.