chore: added meta og data 59ad7815
Steve · 2026-06-08 23:52 16 file(s) · +37 −1
apps/kepler/.env.example +2 −0
6 6
KEPLER_REPO_ROOT=./repos
7 7
# Site name shown in header and feed
8 8
KEPLER_SITE_NAME=kepler
9 +
# Public base URL, used for Open Graph / social meta tags
10 +
KEPLER_BASE_URL=http://localhost:4747
apps/kepler/README.md +1 −0
32 32
| `PORT` | `4747` | |
33 33
| `KEPLER_REPO_ROOT` | `./repos` | dir of bare repos (`*.git/`) or normal repos |
34 34
| `KEPLER_SITE_NAME` | `kepler` | shown in header + feed |
35 +
| `KEPLER_BASE_URL` | `http://localhost:4747` | public URL for Open Graph / social meta tags |
35 36
36 37
## Repo discovery
37 38
apps/kepler/app.go +2 −0
15 15
	Templates map[string]*template.Template
16 16
	RepoRoot  string
17 17
	SiteName  string
18 +
	BaseURL   string
18 19
}
19 20
20 21
type pageBase struct {
21 22
	SiteName string
22 23
	RepoName string
24 +
	BaseURL  string
23 25
}
24 26
25 27
type indexPageData struct {
apps/kepler/handlers.go +1 −1
11 11
const commitsPerPage = 30
12 12
13 13
func (a *App) base(repoName string) pageBase {
14 -
	return pageBase{SiteName: a.SiteName, RepoName: repoName}
14 +
	return pageBase{SiteName: a.SiteName, RepoName: repoName, BaseURL: a.BaseURL}
15 15
}
16 16
17 17
func (a *App) indexHandler(w http.ResponseWriter, r *http.Request) {
apps/kepler/main.go +3 −0
5 5
	"log/slog"
6 6
	"net/http"
7 7
	"os"
8 +
	"strings"
8 9
9 10
	"github.com/stevedylandev/andromeda/pkg/config"
10 11
)
15 16
16 17
	root := config.Getenv("KEPLER_REPO_ROOT", "./repos")
17 18
	siteName := config.Getenv("KEPLER_SITE_NAME", "kepler")
19 +
	baseURL := config.Getenv("KEPLER_BASE_URL", "http://localhost:4747")
18 20
19 21
	tmpl, err := buildTemplates()
20 22
	if err != nil {
26 28
		Templates: tmpl,
27 29
		RepoRoot:  root,
28 30
		SiteName:  siteName,
31 +
		BaseURL:   strings.TrimRight(baseURL, "/"),
29 32
	}
30 33
31 34
	addr := config.Getenv("HOST", "127.0.0.1") + ":" + config.Getenv("PORT", "4747")
apps/kepler/routes.go +17 −0
1 1
package main
2 2
3 3
import (
4 +
	"mime"
4 5
	"net/http"
6 +
	"path"
5 7
)
6 8
7 9
func (a *App) routes() *http.ServeMux {
26 28
		w.Header().Set("Content-Type", "font/otf")
27 29
		w.Header().Set("Cache-Control", "public, max-age=31536000, immutable")
28 30
		w.Header().Set("Access-Control-Allow-Origin", "*")
31 +
		_, _ = w.Write(data)
32 +
	})
33 +
	mux.HandleFunc("GET /assets/{name}", func(w http.ResponseWriter, r *http.Request) {
34 +
		name := r.PathValue("name")
35 +
		data, err := appFS.ReadFile("static/" + name)
36 +
		if err != nil {
37 +
			http.NotFound(w, r)
38 +
			return
39 +
		}
40 +
		ct := mime.TypeByExtension(path.Ext(name))
41 +
		if ct == "" {
42 +
			ct = http.DetectContentType(data)
43 +
		}
44 +
		w.Header().Set("Content-Type", ct)
45 +
		w.Header().Set("Cache-Control", "public, max-age=86400")
29 46
		_, _ = w.Write(data)
30 47
	})
31 48
apps/kepler/static/android-chrome-192x192.png (added) +0 −0

Binary file — no preview.

apps/kepler/static/android-chrome-512x512.png (added) +0 −0

Binary file — no preview.

apps/kepler/static/apple-touch-icon.png (added) +0 −0

Binary file — no preview.

apps/kepler/static/favicon-16x16.png (added) +0 −0

Binary file — no preview.

apps/kepler/static/favicon-32x32.png (added) +0 −0

Binary file — no preview.

apps/kepler/static/favicon.ico (added) +0 −0

Binary file — no preview.

apps/kepler/static/icon.png (added) +0 −0

Binary file — no preview.

apps/kepler/static/og.png (added) +0 −0

Binary file — no preview.

apps/kepler/static/site.webmanifest (added) +1 −0
1 +
{"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"}
apps/kepler/templates/base.html +10 −0
5 5
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
6 6
    <meta name="theme-color" content="#121113">
7 7
    <title>{{block "title" .}}{{.SiteName}}{{end}}</title>
8 +
    <meta name="description" content="Read-only web view for on-disk git repositories">
9 +
    <meta property="og:url" content="{{.BaseURL}}">
10 +
    <meta property="og:type" content="website">
11 +
    <meta property="og:title" content="{{.SiteName}}">
12 +
    <meta property="og:description" content="Read-only web view for on-disk git repositories">
13 +
    <meta property="og:image" content="{{.BaseURL}}/assets/og.png">
14 +
    <link rel="apple-touch-icon" sizes="180x180" href="/assets/apple-touch-icon.png">
15 +
    <link rel="icon" type="image/png" sizes="32x32" href="/assets/favicon-32x32.png">
16 +
    <link rel="icon" type="image/png" sizes="16x16" href="/assets/favicon-16x16.png">
17 +
    <link rel="manifest" href="/assets/site.webmanifest">
8 18
    <link rel="preload" href="/assets/fonts/CommitMono-400-Regular.otf" as="font" type="font/otf" crossorigin>
9 19
    <link rel="preload" href="/assets/fonts/CommitMono-700-Regular.otf" as="font" type="font/otf" crossorigin>
10 20
    <link rel="stylesheet" href="/assets/kepler.css">