commit 15ebbf854f0a9df96c409cb5183b63687dc5a0ba
parent 45d86b36483e286566da93a9c6777559ed34961e
Author: zakaria <58356365+e-zk@users.noreply.github.com>
Date: Tue, 2 Mar 2021 16:21:48 +1000
Change html locations; Update description extraction
Diffstat:
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/common.rc b/common.rc
@@ -81,7 +81,7 @@ gen_nav() {
printf '<header>\n'
printf '<nav>\n'
printf '<a href="%s">%s</a>\n' "/" "$fqdn"
- cat "${html_dir}/nav"
+ cat "${html_dir}/nav.html"
printf '</nav>\n'
printf '</header>\n'
}
@@ -97,7 +97,7 @@ gen_footer() {
printf '<footer>\n'
printf '<a href="./%s">plaintext</a> ' "$(basename "$page_file")"
printf '<a href="%s/%s">onion</a>\n' "$onion_url" "$page_baseurl"
- cat "${html_dir}/footer"
+ cat "${html_dir}/footer.html"
printf '</footer>\n'
}
@@ -107,8 +107,10 @@ gen_footer() {
# $1 - markdown file
gen_desc() {
post_file="$1"
- head -n 4 "$post_file" | sed -e '/#.*/d' -e '/^$/d' | md_to_txt | sed -e 's/\ *$//' | cut -f 1-50 -d' ' | tr -d '\n'
- printf '... [read more]'
+ output="$(head -n 4 "$post_file" | sed -e '/#.*/d' -e '/^$/d' | md_to_txt | sed -e 's/\ *$//' | cut -f 1-50 -d' ' | tr -d '\n')"
+ if [ -n "$output" ]; then
+ printf '... [read more]'
+ fi
}
# $1 - markdown file to generate head for
@@ -133,7 +135,7 @@ gen_head() {
#printf '<link rel="icon" href="/favicon.svg">\n'
#printf '<link rel="alternate icon" href="/favicon.ico">\n'
#printf '<link rel="stylesheet" href="/style.css">\n'
- cat "${html_dir}/head"
+ cat "${html_dir}/head.html"
# open graph tags
printf '<meta property="og:type" content="article">\n'