Wern Ancheta

Adventures in Web Development.

Introduction to Staticizer

| Comments

Welcome to yet another promotional post on another side-project of mine. This time it’s Staticizer, a static site generator.

Yet Another Static Site Generator?

No. This isn’t unlike any static site generator out there. I created this project to create a static version for my antares project. So you can use this to create a static version of an existing project. All it really does is request a URL in your local machine and create an HTML file out of it. This works best for websites that has only a few pages.

How to Use

First you have to update the index.php file and write your own code for fetching the pages in the website you want to convert to a static one.

Next, update the config.php file and change the values for the BASE_URL, STATIC_PATH and JSON_PATH. The BASE_URL is the base URL of the website you want to convert. The STATIC_PATH is the base directory where you want to save the generated HTML files. The JSON_PATH is the path to the json files inside the STATIC_PATH that you specified. This is optional. Only use this if you are serving json files on the original website.

define('BASE_URL', 'http://antaresapp.dev/');
define('STATIC_PATH', 'site');
define('JSON_PATH', 'json');

Note that you have to manually copy front-end assets (css, script, images) in the STATIC_PATH.


This works best with Github pages. Just create a new Github account that directly matches the name of the website. As an example, I created a Github account and named it antaresapp. I then created a new repository named antaresapp.github.io. This will serve as the repository that the Github page will use. Remember that you can only create a single Github page for every Github account.

On your static path, initialize a new Git repo and add the Github page repository as a remote.

Lastly, you can use this project by executing the following commands from your terminal.

To update the database:

php update.php

To generate the static HTML files and JSON files:

php generate.php

To push the changes to the Github repo:

php push.php

If you want to know more about the project, you can check it out here.