diff --git a/src/gmi/tpl.go b/src/gmi/tpl.go
index edd3a75..8f4c3be 100644
--- a/src/gmi/tpl.go
+++ b/src/gmi/tpl.go
@@ -36,6 +36,7 @@ type rendererGetPostSeriesNextPreviousRes struct {
type renderer struct {
url *url.URL
+ publicURL *url.URL
postStore post.Store
preprocessFuncs post.PreprocessFunctions
}
@@ -124,12 +125,24 @@ func (r renderer) GetQueryIntValue(key string, def int) (int, error) {
return strconv.Atoi(vStr)
}
+func (r renderer) GetPath() (string, error) {
+ basePath := filepath.Join("/", r.publicURL.Path) // in case it's empty
+ return filepath.Rel(basePath, r.url.Path)
+}
+
func (r renderer) Add(a, b int) int { return a + b }
func (a *api) tplHandler() (gemini.Handler, error) {
blogURL := func(path string, abs bool) string {
- path = filepath.Join(a.params.PublicURL.Path, path)
+ // filepath.Join strips trailing slash, but we want to keep it
+ trailingSlash := strings.HasSuffix(path, "/")
+
+ path = filepath.Join("/", a.params.PublicURL.Path, path)
+
+ if trailingSlash && path != "/" {
+ path += "/"
+ }
if !abs {
return path
@@ -170,7 +183,7 @@ func (a *api) tplHandler() (gemini.Handler, error) {
path := blogURL(filepath.Join("assets", id), false)
- return fmt.Sprintf("=> %s %s", path, descr), nil
+ return fmt.Sprintf("\n=> %s %s", path, descr), nil
},
}
@@ -247,6 +260,7 @@ func (a *api) tplHandler() (gemini.Handler, error) {
err := tpl.Execute(buf, renderer{
url: r.URL,
+ publicURL: a.params.PublicURL,
postStore: a.params.PostStore,
preprocessFuncs: preprocessFuncs,
})
diff --git a/src/gmi/tpl/feed.xml b/src/gmi/tpl/feed.xml
index 497fb11..a33e42f 100644
--- a/src/gmi/tpl/feed.xml
+++ b/src/gmi/tpl/feed.xml
@@ -1,4 +1,4 @@
-{{ $getPostsRes := .GetPosts 0 15 -}}
+{{ $getPostsRes := .GetPosts 0 20 -}}
{{ $posts := $getPostsRes.Posts -}}
diff --git a/src/gmi/tpl/footer.gmi b/src/gmi/tpl/footer.gmi
new file mode 100644
index 0000000..44782a1
--- /dev/null
+++ b/src/gmi/tpl/footer.gmi
@@ -0,0 +1,8 @@
+================================================================================
+
+{{ if ne .GetPath "index.gmi" -}}
+=> {{ BlogURL "/" }} Home
+
+{{ end -}}
+
+=> {{ BlogURL "wtfpl.txt" }} License for all content, if you must have one
diff --git a/src/gmi/tpl/index.gmi b/src/gmi/tpl/index.gmi
index 9f12e0d..8a0dbee 100644
--- a/src/gmi/tpl/index.gmi
+++ b/src/gmi/tpl/index.gmi
@@ -1,3 +1,61 @@
# mediocregopher's lil web corner
-=> /posts/ See all posts
+This here's my little corner of the web, where I publish posts about projects
+I'm working on and things that interest me (which you can follow, if you like).
+
+=> {{ BlogURL "posts/" }} Browse all posts
+
+{{ $getPostsRes := .GetPosts 0 1 -}}
+{{ if gt (len $getPostsRes.Posts) 0 -}}
+{{ $post := index $getPostsRes.Posts 0 -}}
+=> {{ PostURL $post.ID }} (Latest post: {{ $post.Title }})
+
+{{ end -}}
+
+Below you'll find other information and links related to me.
+
+## Social
+
+Feel free to hmu on any of these if you'd like to get in touch.
+
+* Matrix: @mediocregopher:waffle.farm
+
+* Mastodon: @mediocregopher@social.cryptic.io
+
+* Email: mediocregopher@gmail.com
+
+## Dev
+
+=> https://code.betamike.com/mediocregopher Gitea is for newer open-source code I've written.
+
+=> https://github.com/mediocregopher Github is for older open-source code I've written.
+
+=> gemini://godocs.io/github.com/mediocregopher/radix/v4 radix is for using redis with go.
+
+=> https://code.betamike.com/cryptic-io/cryptic-net cryptic-net implements the foundation of a community infrastucture.
+
+=> https://code.betamike.com/mediocregopher/mediocre-blog mediocre-blog is the CMS I designed from scratch to run this site.
+
+## Art
+
+=> https://opensea.io/mediocregopher?tab=created OpenSea lists some NFTs I've made.
+
+=> https://exchange.art/artists/mediocregopher/series Exchange.art lists others.
+
+## Other
+
+=> https://bgpicciano.com/ bgpicciano.com is my cover site/resume.
+
+=> https://news.cryptic.io/ Cryptic News aggregates interesting blogs.
+
+--------------------------------------------------------------------------------
+
+I'm not affiliated with these, but they're worth listing.
+
+=> https://search.marginalia.nu/ Marginalia reminds me of the old internet.
+
+=> https://www.nts.live/ NTS is a great internet radio station.
+
+=> https://yamakan.place/palestine/# Radio alHara is another great internet radio station.
+
+{{ template "footer.gmi" . }}
diff --git a/src/gmi/tpl/posts/index.gmi b/src/gmi/tpl/posts/index.gmi
index 9d0f6e2..60a62fd 100644
--- a/src/gmi/tpl/posts/index.gmi
+++ b/src/gmi/tpl/posts/index.gmi
@@ -1,10 +1,17 @@
# mediocregopher's Posts
{{ $page := .GetQueryIntValue "page" 0 -}}
-{{ $getPostsRes := .GetPosts $page 15 -}}
+
+{{ if eq $page 0 -}}
+Here you'll find an archive of all published posts. The content varies almost as
+much as the quality!
+
+{{ end -}}
+
+{{ $getPostsRes := .GetPosts $page 20 -}}
{{ if gt $page 0 -}}
-=> /posts/?page={{ .Add $page -1 }} Previous Page
+=> {{ BlogURL "posts" }}/?page={{ .Add $page -1 }} Previous Page
{{ end -}}
@@ -14,8 +21,10 @@
{{ end -}}
{{ if $getPostsRes.HasMore -}}
-=> /posts/?page={{ .Add $page 1 }} Next page
+=> {{ BlogURL "posts" }}/?page={{ .Add $page 1 }} Next page
{{ end }}
-================================================================================
+--------------------------------------------------------------------------------
-=> / Home
+=> {{ BlogURL "feed.xml" }} Subscribe to the RSS feed for updates
+
+{{ template "footer.gmi" . }}
diff --git a/src/gmi/tpl/posts/post.gmi b/src/gmi/tpl/posts/post.gmi
index 7d1719b..e95cb53 100644
--- a/src/gmi/tpl/posts/post.gmi
+++ b/src/gmi/tpl/posts/post.gmi
@@ -4,6 +4,7 @@
{{ if ne $post.Description "" -}}
> {{ $post.Description }}
+
{{ end -}}
{{ .PostBody $post }}
@@ -19,15 +20,14 @@ This post is part of a series!
{{ $seriesNextPrev := .GetPostSeriesNextPrevious $post -}}
{{ if $seriesNextPrev.Next -}}
-=> /posts/{{ $seriesNextPrev.Next.ID }}.gmi Next: {{ $seriesNextPrev.Next.Title }}
+=> {{ BlogURL "posts" }}/{{ $seriesNextPrev.Next.ID }}.gmi Next in the series: {{ $seriesNextPrev.Next.Title }}
{{ end -}}
{{ if $seriesNextPrev.Previous -}}
-=> /posts/{{ $seriesNextPrev.Previous.ID }}.gmi Previously: {{ $seriesNextPrev.Previous.Title }}
+=> {{ BlogURL "posts" }}/{{ $seriesNextPrev.Previous.ID }}.gmi Prevous in the series: {{ $seriesNextPrev.Previous.Title }}
{{ end -}}
{{ end }}
-================================================================================
+=> {{ BlogURL "posts/" }} Browse all posts
-=> /posts/ More posts
-=> / Home
+{{ template "footer.gmi" . }}
diff --git a/src/http/tpl/index.html b/src/http/tpl/index.html
index f19b550..c9eb45b 100644
--- a/src/http/tpl/index.html
+++ b/src/http/tpl/index.html
@@ -1,20 +1,19 @@
{{ define "body" }}
- Hi! I'm Brian, and this here's my little corner of the web. Here I write
+ This here's my little corner of the web, where I publish
posts
about projects I'm working on and things that interest me (which you can
follow,
- if you like). Beyond that I've listed various links related to me below.
+ if you like).
Social
+ Feel free to hmu on any of these if you'd like to get in touch.
Dev
@@ -36,12 +35,17 @@
Exchange.art lists others.
+ Other
+
+
I'm not affiliated with these, but they're worth listing.
- Marginalia reminds me of the old internet.
- - Gemini is a protocol I soon hope to add to this site.
- NTS is a great internet radio station.
- Radio alHara is another great internet radio station.
diff --git a/src/http/tpl/posts.html b/src/http/tpl/posts.html
index ef94ffb..e6d226b 100644
--- a/src/http/tpl/posts.html
+++ b/src/http/tpl/posts.html
@@ -6,8 +6,8 @@
{{ else }}
- Posts are listed in chronological order. If you aren't sure of where to
- start I recommend picking at random.
+ Here you'll find an archive of all published posts. The content varies
+ almost as much as the quality!
{{ end }}