site

A custom static site generator written in C.
git clone https://unitehenry.com/git/site.git
Log | Files | Refs | README

commit 8996f5ffa8e303f1452903e650c120700b116703
parent 4993ced66fe952c529bf52592484278ccb9ce503
Author: Henry Unite <unitehenry@gmail.com>
Date:   Sun, 12 Apr 2026 00:12:19 +0000

feat: copy static

Diffstat:
Msrc/generate.c | 13++++++++++++-
Msrc/generate.h | 1+
Msrc/main.c | 2++
Astatic/css/style.css | 3+++
4 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/src/generate.c b/src/generate.c @@ -9,9 +9,10 @@ #define BUILD_DIRECTORY "build" #define BASE_TEMPLATE "templates/base.html" #define CONTENT_TAG "{{ content }}" +#define STATIC_DIRECTORY "static" void run_pandoc(FILE **fp, char *content_path) { - char *PANDOC_CMD = "pandoc "; + const char *PANDOC_CMD = "pandoc "; size_t command_len = strlen(content_path) + strlen(PANDOC_CMD) + 2; @@ -195,3 +196,13 @@ void generate_pages(StringList *list) { i++; } } + +void copy_static() { + const char *CP_CMD = "cp "; + + char *command = NULL; + + asprintf(&command, "%s -rf %s/* %s", CP_CMD, STATIC_DIRECTORY, BUILD_DIRECTORY); + + popen(command, "r"); +} diff --git a/src/generate.h b/src/generate.h @@ -5,5 +5,6 @@ void get_content_files(StringList *list, char *content_path); void generate_pages(StringList *list); +void copy_static(); #endif diff --git a/src/main.c b/src/main.c @@ -15,5 +15,7 @@ int main(int argc, char **argv) { generate_pages(list); + copy_static(); + return 0; } diff --git a/static/css/style.css b/static/css/style.css @@ -0,0 +1,3 @@ +html { + background: red; +}