From dd8b9b655b33bd7765721da6b4786c8ea73ed8d8 Mon Sep 17 00:00:00 2001 From: Roan Horning Date: Wed, 29 Jun 2022 11:03:32 -0400 Subject: [PATCH] Configure root template page in config file Currently the root template is page.tpl.html. --- site-generator | 8 ++++---- site.cfg | 5 +++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/site-generator b/site-generator index f59052e..a984089 100755 --- a/site-generator +++ b/site-generator @@ -55,7 +55,7 @@ sub main { read_config "site.cfg" => my %config; my $tt = get_template_html($config{DBI}); - generate_page($tt, $config{correspondents}{navigation}, $config{correspondents}{content}); + generate_page($tt, $config{root_template}{content}, $config{correspondents}{navigation}, $config{correspondents}{content}); return 0; } @@ -79,14 +79,14 @@ sub get_template_html (\%@) { } -sub generate_page ($tt, $navigation, $content) { - my ($tt, $navigation, $content) = @_; +sub generate_page { + my ($tt, $page, $navigation, $content) = @_; my $tt_vars = { navigation => $navigation, content => $content }; - $tt->process('page.tpl.html', $tt_vars) + $tt->process($page, $tt_vars) || die $tt->error(), "\n"; } diff --git a/site.cfg b/site.cfg index e023acc..f90fab6 100644 --- a/site.cfg +++ b/site.cfg @@ -6,6 +6,11 @@ driver: dbi:SQLite:hpr.db user: password: +# Configure the root template page which pulls in the navigation and +# content templates used by each page. +[root_template] +content: page.tpl.html + # Configure the navigation menu and the content templates for each page # of the site: # [page_name]