Final fleshing out of gemini content

main
Brian Picciano 1 year ago
parent 5b5a043868
commit acec797048
  1. 18
      src/gmi/tpl.go
  2. 2
      src/gmi/tpl/feed.xml
  3. 8
      src/gmi/tpl/footer.gmi
  4. 60
      src/gmi/tpl/index.gmi
  5. 19
      src/gmi/tpl/posts/index.gmi
  6. 10
      src/gmi/tpl/posts/post.gmi
  7. 20
      src/http/tpl/index.html
  8. 4
      src/http/tpl/posts.html

@ -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,
})

@ -1,4 +1,4 @@
{{ $getPostsRes := .GetPosts 0 15 -}}
{{ $getPostsRes := .GetPosts 0 20 -}}
{{ $posts := $getPostsRes.Posts -}}
<?xml version="1.0" encoding="UTF-8"?><feed xmlns="http://www.w3.org/2005/Atom">

@ -0,0 +1,8 @@
================================================================================
{{ if ne .GetPath "index.gmi" -}}
=> {{ BlogURL "/" }} Home
{{ end -}}
=> {{ BlogURL "wtfpl.txt" }} License for all content, if you must have one

@ -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" . }}

@ -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 }}
================================================================================
--------------------------------------------------------------------------------
=> {{ BlogURL "feed.xml" }} Subscribe to the RSS feed for updates
=> / Home
{{ template "footer.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" . }}

@ -1,20 +1,19 @@
{{ define "body" }}
<p>
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
<a href="{{ BlogURL "posts" }}">posts</a>
about projects I'm working on and things that interest me (which you can
<a href="{{ BlogURL "follow" }}">follow</a>,
if you like). Beyond that I've listed various links related to me below.
if you like).
</p>
<h2>Social</h2>
<p>Feel free to hmu on any of these if you'd like to get in touch.</p>
<ul>
<li><a href="https://matrix.to/#/@mediocregopher:waffle.farm">@mediocregopher:waffle.farm</a> is my matrix handle.</li>
<li><a href="https://social.cryptic.io/@mediocregopher">@mediocregopher@social.cryptic.io</a> is my mastodon handle.</li>
<li><a href="https://bgpicciano.com">bgpicciano.com</a> is my cover site/resume.</li>
<li><a href="mailto:mediocregopher@gmail.com">mediocregopher@gmail.com</a> is my email.</li>
<li><a href="https://news.cryptic.io">Cryptic News</a> aggregates interesting blogs.</li>
<li>Matrix: <a href="https://matrix.to/#/@mediocregopher:waffle.farm">@mediocregopher:waffle.farm</a></li>
<li>Mastodon: <a href="https://social.cryptic.io/@mediocregopher">@mediocregopher@social.cryptic.io</a></li>
<li>Email: <a href="mailto:mediocregopher@gmail.com">mediocregopher@gmail.com</a></li>
</ul>
<h2>Dev</h2>
@ -36,12 +35,17 @@
<li><a href="https://exchange.art/artists/mediocregopher/series">Exchange.art</a> lists others.</li>
</ul>
<h2>Other</h2>
<ul>
<li><a href="https://bgpicciano.com">bgpicciano.com</a> is my cover site/resume.</li>
<li><a href="https://news.cryptic.io">Cryptic News</a> aggregates interesting blogs.</li>
</ul>
<hr/>
<p>I'm not affiliated with these, but they're worth listing.</p>
<ul>
<li><a href="https://search.marginalia.nu/">Marginalia</a> reminds me of the old internet.</li>
<li><a href="https://drewdevault.com/2020/11/01/What-is-Gemini-anyway.html">Gemini</a> is a protocol I soon hope to add to this site.</li>
<li><a href="https://www.nts.live/">NTS</a> is a great internet radio station.</li>
<li><a href="https://yamakan.place/palestine/#">Radio alHara</a> is another great internet radio station.</li>
</ul>

@ -6,8 +6,8 @@
</p>
{{ else }}
<p>
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!
</p>
{{ end }}

Loading…
Cancel
Save