add gophermap support

This commit is contained in:
Ben Harris 2018-07-21 23:33:22 -04:00
parent 70d43d37d5
commit 10bba2dfbb
Signed by: ben
GPG Key ID: 4E0AF802FFF7960C
1 changed files with 888 additions and 863 deletions

27
bb.sh
View File

@ -67,6 +67,8 @@ global_variables() {
archive_index="all_posts.html"
tags_index="all_tags.html"
gophermap="gophermap"
# Non blogpost files. Bashblog will ignore these. Useful for static pages and custom content
# Add them as a bash array, e.g. non_blogpost_files=("news.html" "test.html")
non_blogpost_files=()
@ -393,7 +395,7 @@ is_boilerplate_file() {
done
case $name in
( "$index_file" | "$archive_index" | "$tags_index" | "$footer_file" | "$header_file" | "$global_analytics_file" | "$prefix_tags"* )
( "$index_file" | "$archive_index" | "$gophermap" | "$tags_index" | "$footer_file" | "$header_file" | "$global_analytics_file" | "$prefix_tags"* )
return 0 ;;
( * ) # Check for excluded
for excl in "${html_exclude[@]}"; do
@ -927,6 +929,28 @@ make_rss() {
chmod 644 "$blog_feed"
}
make_gophermap() {
if [ ! -d "${HOME}/public_gopher" ]; then
printf "Creating gopher hole\\n"
mkdir "${HOME}/public_gopher"
fi
if [ ! -L "${HOME}/public_gopher" ]; then
ln -s "${HOME}/public_html/blog/" "${HOME}/public_gopher/blog"
fi
cat <<- 'EOF' > $HOME/public_html/blog/gophermap
#!/bin/bash
echo -e "my bashblog posts\n"
user=$(stat -c '%U' .)
for post in *.md; do
post=$(basename $post)
echo -e "0$post\t/~$user/blog/$post\ttilde.team\t70"
done
EOF
chmod +x $HOME/public_html/blog/gophermap
}
# generate headers, footers, etc
create_includes() {
{
@ -1178,6 +1202,7 @@ do_main() {
all_posts
all_tags
make_rss
make_gophermap
delete_includes
}