forked from team/bashblog
add gophermap support
This commit is contained in:
parent
70d43d37d5
commit
10bba2dfbb
27
bb.sh
27
bb.sh
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue