Add template and HTML folder configuration options

Allow user to set the path for the website templates and
output folders in the site.cfg file.
This commit is contained in:
Roan Horning 2023-03-09 20:25:25 -05:00
parent 14bafbc3ab
commit f65e892182
Signed by untrusted user: rho_n
GPG Key ID: 234AEF20B72D5769
2 changed files with 9 additions and 4 deletions

View File

@ -143,7 +143,7 @@ sub main {
exit 1; exit 1;
} }
my $tt = get_template_html($config{DBI}); my $tt = get_template_html($config{DBI}, $config{app_paths});
# If command line option all is set, parse configuration file # If command line option all is set, parse configuration file
# for all pages # for all pages
@ -154,7 +154,7 @@ sub main {
# from the generated list of pages. # from the generated list of pages.
@page_args= grep { $_ ne 'DBI' } @page_args; @page_args= grep { $_ ne 'DBI' } @page_args;
@page_args= grep { $_ ne 'root_template' } @page_args; @page_args= grep { $_ ne 'root_template' } @page_args;
@page_args= grep { $_ ne 'media_hostname' } @page_args; @page_args= grep { $_ ne 'app_paths' } @page_args;
}; };
foreach my $page_arg (@page_args) { foreach my $page_arg (@page_args) {
@ -207,8 +207,8 @@ sub get_template_html (\%@) {
# HTML comments to make the template file valid HTML. # HTML comments to make the template file valid HTML.
# #
return Template->new({ return Template->new({
INCLUDE_PATH => './templates', INCLUDE_PATH => $_[1]{templates_path},
OUTPUT_PATH => './public_html', OUTPUT_PATH => $_[1]{output_path},
EVAL_PERL => 1, EVAL_PERL => 1,
START_TAG => '<!--%', START_TAG => '<!--%',
END_TAG => '%-->', END_TAG => '%-->',

View File

@ -13,6 +13,11 @@
#user: hpr-generator (Suggested user with read-only privileges) #user: hpr-generator (Suggested user with read-only privileges)
#password: ********* (Password for user) #password: ********* (Password for user)
# Configure the location of the templates and the generated HTML
[app_paths]
templates_path: ./templates
output_path: ./public_html
# Configure the root template page which pulls in the navigation and # Configure the root template page which pulls in the navigation and
# content templates used by each page. An optional baseurl property may # content templates used by each page. An optional baseurl property may
# be defined. This is useful when opening files directly from local # be defined. This is useful when opening files directly from local