Skip to content

cPageBuild

cPageBuild is a static website generator 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):

Download V1.00

Detailed manual

For details on how to use cPagebuild, see the cPageBuild manual.

Target audience

cPageBuild may be suited for you if:

  • You are a C/C++ developer and familiar with the 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.

Features

  • Everything that the preprocessor supports
  • Custom escape sequences for whitespace and string control
  • Optional HTML minification
  • XML sitemap generation
  • Support for nested directories
  • Multi-threaded builds: 10k pages per minute with 4 threads
  • Incremental builds: 300 ms for 10k unchanged pages.

Limitations

  • No layout templates available
  • No markdown
  • No pagination
  • No categories or tags
  • No automatic syntax highlighting
  • Preformatted text needs hacks.

Getting started

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.

Supported platforms

  • Linux
  • Windows
  • macOS (probably).

Dependencies

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 configure the path directly instead in the shell scripts resp. batch files.

For generating the cPageBuild executable, make is required under Linux while it is optional under Windows.

Installation

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 having generated 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”.

Demo project

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.

Licence

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.