about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorglenda <glenda@9front.local>2021-01-14 23:20:07 +0000
committerglenda <glenda@9front.local>2021-01-14 23:20:07 +0000
commitfedcb171ffad253618159ce4966b5bec1efd08a0 (patch)
tree58a1547614914eb1e559940d3f20f39eeeace5f5
parent86de758b9a84f776b5abe80f119d1d81e745c60f (diff)
downloadg9srv-fedcb171ffad253618159ce4966b5bec1efd08a0.tar.gz
added blog thing
-rw-r--r--README8
-rwxr-xr-xblog51
2 files changed, 58 insertions, 1 deletions
diff --git a/README b/README
index c9239fe..5f300fe 100644
--- a/README
+++ b/README
@@ -9,8 +9,14 @@ webroot/fulton.software/index.gmi
 
 webroot/plan9.fulton.software/index.gmi
 
+g9srv/blog
+The config is the script it self
+$webroot/posts are where your post are stored
+
+Post name should be: YYYY-MM-DD+name+more+of+the+name
+
+
 Coming soon:
-Blog host
 
 Werc
 
diff --git a/blog b/blog
new file mode 100755
index 0000000..d382c58
--- /dev/null
+++ b/blog
@@ -0,0 +1,51 @@
+#!/bin/rc
+cr=

+webroot = ./
+while(! ~ $#* 0) {
+	switch ($1) {
+	case -w
+		webroot=$2
+		shift'
+	case *
+		echo Usage: g9srv/blog [-w webroot]
+		exit usage
+	}
+	shift
+}
+sitename='Fultons gem pod'
+blogname='My blog'
+fn header{
+	echo $1 $2$cr
+}
+fn gettitle{
+	echo `{echo $1 | sed 's/\+/ /g'}
+}
+posts=`{ls -p $webroot/posts}
+fullurl=`{read}
+url=`{echo $fullurl | sed 's/gemini:\/\/[0-9 a-z .]*//
+			s/
//'}
+
+if(~ $url '') url=/
+
+if (~ $url '/'){
+	header 20 text/gemini
+	echo '#' $sitename
+	echo $tagline
+	echo '##' $blogname
+
+	for(i in $posts){
+		name=`{gettitle $i}
+		echo '=>' posts/$i $name
+	}
+
+	cat homepage
+	exit 0
+}
+
+if(test -f $webroot$url){
+	header 20 text/gemini
+	cat $webroot$url
+}
+
+
+