From 9dc52b23b8b0c27bd9f0437d590daf8e4b145ee0 Mon Sep 17 00:00:00 2001 From: Anirudh Oppiliappan Date: Wed, 15 Oct 2025 16:33:22 +0300 Subject: [PATCH] appview/pages: seo improvements, sitemap, schemae and more Change-Id: xzpvnptzsmkyvnrspootptpsutyrxxyv Signed-off-by: Anirudh Oppiliappan --- .../pages/templates/fragments/breadcrumb.html | 22 ++++++++ .../pages/templates/fragments/dolly/logo.html | 9 ---- .../pages/templates/fragments/dolly/logo.svg | 44 +++++++++++++++ .../templates/goodfirstissues/index.html | 29 +++++++++- appview/pages/templates/layouts/base.html | 28 +++++++++- .../pages/templates/layouts/profilebase.html | 21 +++++++- appview/pages/templates/repo/index.html | 36 +++++++++++++ appview/pages/templates/timeline/home.html | 52 ++++++++++++++++-- appview/state/router.go | 1 + appview/state/state.go | 53 +++++++++++++++++++ 10 files changed, 278 insertions(+), 17 deletions(-) create mode 100644 appview/pages/templates/fragments/breadcrumb.html create mode 100644 appview/pages/templates/fragments/dolly/logo.svg diff --git a/appview/pages/templates/fragments/breadcrumb.html b/appview/pages/templates/fragments/breadcrumb.html new file mode 100644 index 00000000..68297379 --- /dev/null +++ b/appview/pages/templates/fragments/breadcrumb.html @@ -0,0 +1,22 @@ +{{ define "fragments/breadcrumb" }} + {{ $items := . }} + {{ if gt (len $items) 0 }} + + {{ end }} +{{ end }} \ No newline at end of file diff --git a/appview/pages/templates/fragments/dolly/logo.html b/appview/pages/templates/fragments/dolly/logo.html index 4eba8fd4..0642050a 100644 --- a/appview/pages/templates/fragments/dolly/logo.html +++ b/appview/pages/templates/fragments/dolly/logo.html @@ -37,15 +37,6 @@ inkscape:groupmode="layer" inkscape:label="Image" id="g1"> - + Dolly + + + + + + + + diff --git a/appview/pages/templates/goodfirstissues/index.html b/appview/pages/templates/goodfirstissues/index.html index b4fa8dd1..255b6b84 100644 --- a/appview/pages/templates/goodfirstissues/index.html +++ b/appview/pages/templates/goodfirstissues/index.html @@ -1,12 +1,37 @@ {{ define "title" }}good first issues{{ end }} {{ define "extrameta" }} + + + - + - + + + + + + + + {{ end }} +{{ define "canonical" }}https://tangled.org/goodfirstissues{{ end }} + {{ define "content" }}
diff --git a/appview/pages/templates/layouts/base.html b/appview/pages/templates/layouts/base.html index 466a3854..a5126149 100644 --- a/appview/pages/templates/layouts/base.html +++ b/appview/pages/templates/layouts/base.html @@ -4,8 +4,13 @@ - + + + + + + @@ -14,6 +19,9 @@ + + {{ block "rss" . }}{{ end }} + @@ -21,7 +29,23 @@ - {{ block "title" . }}{{ end }} · tangled + {{ block "title" . }}{{ end }} + + + {{ block "structuredData" . }} + + {{ end }} + {{ block "extrameta" . }}{{ end }} diff --git a/appview/pages/templates/layouts/profilebase.html b/appview/pages/templates/layouts/profilebase.html index 7c04eb64..eecb6b67 100644 --- a/appview/pages/templates/layouts/profilebase.html +++ b/appview/pages/templates/layouts/profilebase.html @@ -9,11 +9,30 @@ - + + + + +{{ end }} + +{{ define "canonical" }}https://tangled.org/{{ or .Card.UserHandle .Card.UserDid }}{{ end }} + +{{ define "rss" }} + {{ end }} {{ define "content" }} diff --git a/appview/pages/templates/repo/index.html b/appview/pages/templates/repo/index.html index f8148dba..6101df39 100644 --- a/appview/pages/templates/repo/index.html +++ b/appview/pages/templates/repo/index.html @@ -5,6 +5,42 @@ {{ template "repo/fragments/meta" . }} {{ template "repo/fragments/og" (dict "RepoInfo" .RepoInfo) }} + + + + + + {{ template "fragments/breadcrumb" (list + (list "Home" "https://tangled.org") + (list .RepoInfo.OwnerWithAt (printf "https://tangled.org/%s" .RepoInfo.OwnerWithAt)) + (list .RepoInfo.Name (printf "https://tangled.org/%s" .RepoInfo.FullName)) + ) }} +{{ end }} + +{{ define "canonical" }}https://tangled.org/{{ .RepoInfo.FullName }}{{ end }} + +{{ define "rss" }} + {{ end }} {{ define "repoContent" }} diff --git a/appview/pages/templates/timeline/home.html b/appview/pages/templates/timeline/home.html index febf520e..6e098d82 100644 --- a/appview/pages/templates/timeline/home.html +++ b/appview/pages/templates/timeline/home.html @@ -1,12 +1,58 @@ {{ define "title" }}tangled · tightly-knit social coding{{ end }} {{ define "extrameta" }} - - + {{ $desc := "Collaborate on code with decentralized git hosting, modern contribution and review workflows, and lightweight CI/CD pipelines." }} + {{ $title = "tangled · tightly-knit social coding" }} + + + + - + + + + + + + + + + + + + {{ end }} +{{ define "canonical" }}https://tangled.org{{ end }} + {{ define "content" }}
diff --git a/appview/state/router.go b/appview/state/router.go index ef44896d..6359b6af 100644 --- a/appview/state/router.go +++ b/appview/state/router.go @@ -36,6 +36,7 @@ func (s *State) Router() http.Handler { router.Get("/favicon.ico", s.Favicon) router.Get("/pwa-manifest.json", s.PWAManifest) router.Get("/robots.txt", s.RobotsTxt) + router.Get("/sitemap.xml", s.Sitemap) userRouter := s.UserRouter(&middleware) standardRouter := s.StandardRouter(&middleware) diff --git a/appview/state/state.go b/appview/state/state.go index 78c4fbbd..0ac75bff 100644 --- a/appview/state/state.go +++ b/appview/state/state.go @@ -205,10 +205,63 @@ func (s *State) RobotsTxt(w http.ResponseWriter, r *http.Request) { robotsTxt := `User-agent: * Allow: / +Disallow: /settings +Disallow: /notifications +Disallow: /login +Disallow: /logout +Disallow: /signup +Disallow: /oauth +Disallow: */settings$ +Disallow: */settings/* + +Crawl-delay: 1 + +Sitemap: https://tangled.org/sitemap.xml ` w.Write([]byte(robotsTxt)) } +func (s *State) Sitemap(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/xml; charset=utf-8") + w.Header().Set("Cache-Control", "public, max-age=3600") + + // basic sitemap with static pages + sitemap := ` + + + https://tangled.org + daily + 1.0 + + + https://tangled.org/timeline + hourly + 0.9 + + + https://tangled.org/goodfirstissues + daily + 0.8 + + + https://tangled.org/terms + monthly + 0.3 + + + https://tangled.org/privacy + monthly + 0.3 + + + https://tangled.org/brand + monthly + 0.5 + +` + w.Write([]byte(sitemap)) +} + // https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps/Manifest const manifestJson = `{ "name": "tangled", -- 2.43.0