diff --git a/main.c b/main.c
index 7ecb908..7b4a19a 100644
--- a/main.c
+++ b/main.c
@@ -108,19 +108,24 @@ void get_posts(const char *path, Post *posts, int *count) {
void generate_pagination(Post *posts, int total_posts, int posts_per_page) {
header = doinsert("./media/header.html");
- footer = doinsert("./media/footer.html");
- int total_pages = (total_posts + posts_per_page - 1) / posts_per_page;
+ int total_pages = (total_posts + posts_per_page - 1) / posts_per_page;
FILE *archive = fopen("./target/archive.html", "w");
if (archive == NULL) {
perror("Galat archive.html");
return;
}
+ printf("%s", header);
fprintf(archive, "\n
\n\n");
fprintf(archive, "Archive - %s", SUBTITLE);
fprintf(archive, "\n\n");
+ if (header != NULL) {
+ fprintf(archive, "%s", header);
+ } else {
+ fprintf(stderr, "ga bisa buat header wqwqwq");
+ }
+
fprintf(archive, "");
-
fprintf(archive,"Archive
");
for(int page = 0; page < total_pages; page++) {
@@ -137,6 +142,13 @@ void generate_pagination(Post *posts, int total_posts, int posts_per_page) {
fprintf(page_file, "\n\n\n");
fprintf(page_file, "Page %d - %s", page+1, SUBTITLE);
fprintf(page_file, "\n");
+
+ if (header != NULL) {
+ fprintf(page_file, "%s", header);
+ } else {
+ fprintf(stderr, "ga bisa buat header wqwqwq");
+ }
+
fprintf(page_file,"Page %d
", page + 1);
int start = page * posts_per_page;
@@ -148,6 +160,7 @@ void generate_pagination(Post *posts, int total_posts, int posts_per_page) {
fprintf(page_file, "- %s
", html_name, posts[i].name);
}
fprintf(page_file, "
\nkembali");
+ footer = doinsert("./media/footer.html");
if (footer != NULL) {
fprintf(page_file, "%s", footer);
} else {