52 lines
1.9 KiB
Bash
52 lines
1.9 KiB
Bash
#!/usr/bin/env bash
|
|
|
|
# generate headers, footers, etc
|
|
declare global_author
|
|
declare global_author_url
|
|
declare global_description
|
|
declare global_email
|
|
declare global_feedburner
|
|
declare global_license
|
|
declare global_title
|
|
declare global_url
|
|
declare index_file
|
|
declare header_file
|
|
declare css_include
|
|
declare template_subscribe_browser_button
|
|
declare blog_feed
|
|
declare footer_file
|
|
create_includes() {
|
|
{
|
|
echo "<h1 class=\"nomargin\"><a class=\"ablack\" href=\"$global_url/$index_file\">$global_title</a></h1>"
|
|
echo "<div id=\"description\">$global_description</div>"
|
|
} > ".title.html"
|
|
|
|
if [[ -f $header_file ]]; then
|
|
cp "$header_file" .header.html
|
|
else
|
|
{
|
|
echo '<!DOCTYPE html>'
|
|
echo '<html lang="en"><head>'
|
|
echo '<meta charset="UTF-8">'
|
|
echo '<meta name="viewport" content="width=device-width, initial-scale=1.0">'
|
|
printf '<link rel="stylesheet" href="%s" type="text/css">\n' "${css_include[@]}"
|
|
if [[ -z $global_feedburner ]]; then
|
|
echo "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"$template_subscribe_browser_button\" href=\"$blog_feed\">"
|
|
else
|
|
echo "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"$template_subscribe_browser_button\" href=\"$global_feedburner\">"
|
|
fi
|
|
} > ".header.html"
|
|
fi
|
|
|
|
if [[ -f $footer_file ]]; then
|
|
cp "$footer_file" .footer.html
|
|
else
|
|
{
|
|
protected_mail=${global_email//@/@}
|
|
protected_mail=${protected_mail//./.}
|
|
echo "<div id=\"footer\">$global_license <a href=\"$global_author_url\">$global_author</a> — <a href=\"mailto:$protected_mail\">$protected_mail</a><br>"
|
|
echo 'generated with <a href="https://tildegit.org/team/bashblog">bashblog</a>, a single bash script to easily create blogs like this one</div>'
|
|
} >> ".footer.html"
|
|
fi
|
|
}
|