try page embed
This commit is contained in:
parent
be89141c06
commit
513d0e57ce
10 changed files with 29 additions and 26 deletions
14
internal/microblog/microblog.gmi
Normal file
14
internal/microblog/microblog.gmi
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
# Microblog
|
||||
|
||||
An aggregation of tweet like posts from my various social media platforms.
|
||||
|
||||
clearnet version:
|
||||
|
||||
=> https://travisshears.com/micro-blog
|
||||
|
||||
So for it renders posts from:
|
||||
* nostr, id: nprofile1qyxhwumn8ghj7mn0wvhxcmmvqqs9udcv9uhqggjz87js9rtaph4lajlxnxsvwvm7zwdjt6etzyk52rgeg4wrz
|
||||
|
||||
I plan to add more platforms in the future:
|
||||
* mastodon, id: dice.camp/@travisshears
|
||||
* bluesky, id: @travisshears.bsky.social
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
package microblog
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"gemini_site/internal/pocketbase"
|
||||
"log/slog"
|
||||
"os"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
|
@ -216,6 +216,9 @@ func drawPost(builder *strings.Builder, p post) {
|
|||
// p.Timestamp.Format("2006-01-02 15:04")))
|
||||
}
|
||||
|
||||
//go:embed microblog.gmi
|
||||
var pageContnet string
|
||||
|
||||
// serveBlogIndex serves the main blog page with recent posts
|
||||
func (mb *MicroBlog) serveIndex(w gemini.ResponseWriter, req *gemini.Request, pageNum int) {
|
||||
w.WriteStatusMsg(gemini.StatusSuccess, "text/gemini")
|
||||
|
|
@ -225,12 +228,7 @@ func (mb *MicroBlog) serveIndex(w gemini.ResponseWriter, req *gemini.Request, pa
|
|||
// content.WriteString("Here are my microblog posts from various plantforms\n")
|
||||
// Read and include the contents of ../../pages/microblog.gmi
|
||||
if pageNum == 1 {
|
||||
page, err := os.ReadFile("./pages/microblog.gmi")
|
||||
if err != nil {
|
||||
slog.Error("Problem reading microblog page", "error", err)
|
||||
return
|
||||
}
|
||||
content.Write(page)
|
||||
content.Write([]byte(pageContnet))
|
||||
content.WriteString("\n")
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue