A container registry that uses the AT Protocol for manifest storage and S3 for blob storage.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix open graph

+49 -41
+16 -3
pkg/appview/handlers/common.go
··· 13 13 User *db.User // Logged-in user (nil if not logged in) 14 14 Query string // Search query from URL parameter 15 15 RegistryURL string // Base registry URL 16 + 17 + // Open Graph meta tag fields - set by individual page handlers 18 + OGTitle string // og:title content 19 + OGDescription string // og:description content 20 + OGImage string // og:image URL 21 + OGType string // og:type (website, profile, etc.) 22 + OGURL string // og:url - canonical URL for the page 16 23 } 17 24 18 25 // NewPageData creates a PageData struct with common fields populated from the request 26 + // Sets default OG values for the home page - individual handlers override these 19 27 func NewPageData(r *http.Request, registryURL string) PageData { 20 28 return PageData{ 21 - User: middleware.GetUser(r), 22 - Query: r.URL.Query().Get("q"), 23 - RegistryURL: registryURL, 29 + User: middleware.GetUser(r), 30 + Query: r.URL.Query().Get("q"), 31 + RegistryURL: registryURL, 32 + OGTitle: "ATCR - Distributed Container Registry", 33 + OGDescription: "Push and pull Docker images on the AT Protocol", 34 + OGImage: registryURL + "/web-app-manifest-512x512.png", 35 + OGType: "website", 36 + OGURL: registryURL, 24 37 } 25 38 } 26 39
+17 -1
pkg/appview/handlers/repository.go
··· 206 206 } 207 207 } 208 208 209 + // Build page data with OG tags for repository 210 + pageData := NewPageData(r, h.RegistryURL) 211 + pageData.OGTitle = owner.Handle + "/" + repository + " - ATCR" 212 + pageData.OGType = "website" 213 + pageData.OGURL = h.RegistryURL + "/r/" + owner.Handle + "/" + repository 214 + if repo.Description != "" { 215 + pageData.OGDescription = repo.Description 216 + } else { 217 + pageData.OGDescription = "Container image on ATCR" 218 + } 219 + if repo.IconURL != "" { 220 + pageData.OGImage = repo.IconURL 221 + } else if owner.Avatar != "" { 222 + pageData.OGImage = owner.Avatar 223 + } 224 + 209 225 data := struct { 210 226 PageData 211 227 Owner *db.User // Repository owner ··· 217 233 IsOwner bool // Whether current user owns this repository 218 234 ReadmeHTML template.HTML 219 235 }{ 220 - PageData: NewPageData(r, h.RegistryURL), 236 + PageData: pageData, 221 237 Owner: owner, 222 238 Repository: repo, 223 239 Tags: tagsWithPlatforms,
+11 -1
pkg/appview/handlers/user.go
··· 79 79 }) 80 80 } 81 81 82 + // Build page data with OG tags for user profile 83 + pageData := NewPageData(r, h.RegistryURL) 84 + pageData.OGTitle = viewedUser.Handle + " - ATCR" 85 + pageData.OGDescription = "Container images by " + viewedUser.Handle + " on ATCR" 86 + pageData.OGType = "profile" 87 + pageData.OGURL = h.RegistryURL + "/u/" + viewedUser.Handle 88 + if viewedUser.Avatar != "" { 89 + pageData.OGImage = viewedUser.Avatar 90 + } 91 + 82 92 data := struct { 83 93 PageData 84 94 ViewedUser *db.User // User whose page we're viewing 85 95 Repositories []db.RepoCardData 86 96 HasProfile bool 87 97 }{ 88 - PageData: NewPageData(r, h.RegistryURL), 98 + PageData: pageData, 89 99 ViewedUser: viewedUser, 90 100 Repositories: cards, 91 101 HasProfile: hasProfile,
+5 -36
pkg/appview/templates/components/head.html
··· 3 3 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 4 4 5 5 <!-- Open Graph Meta Tags --> 6 - {{ if .ViewedUser }} 7 - <!-- User Profile Page --> 8 - <meta property="og:title" content="{{ .ViewedUser.Handle }} - ATCR"> 9 - <meta property="og:description" content="Container images by {{ .ViewedUser.Handle }} on ATCR"> 10 - {{ if .ViewedUser.Avatar }} 11 - <meta property="og:image" content="{{ .ViewedUser.Avatar }}"> 12 - {{ else }} 13 - <meta property="og:image" content="{{ .RegistryURL }}/web-app-manifest-512x512.png"> 14 - {{ end }} 15 - <meta property="og:type" content="profile"> 16 - <meta property="og:url" content="{{ .RegistryURL }}/u/{{ .ViewedUser.Handle }}"> 17 - {{ else if .Repository }} 18 - <!-- Repository Page --> 19 - <meta property="og:title" content="{{ .Owner.Handle }}/{{ .Repository.Name }} - ATCR"> 20 - {{ if .Repository.Description }} 21 - <meta property="og:description" content="{{ .Repository.Description }}"> 22 - {{ else }} 23 - <meta property="og:description" content="Container image on ATCR"> 24 - {{ end }} 25 - {{ if .Repository.IconURL }} 26 - <meta property="og:image" content="{{ .Repository.IconURL }}"> 27 - {{ else if .Owner.Avatar }} 28 - <meta property="og:image" content="{{ .Owner.Avatar }}"> 29 - {{ else }} 30 - <meta property="og:image" content="{{ .RegistryURL }}/web-app-manifest-512x512.png"> 31 - {{ end }} 32 - <meta property="og:type" content="website"> 33 - <meta property="og:url" content="{{ .RegistryURL }}/r/{{ .Owner.Handle }}/{{ .Repository.Name }}"> 34 - {{ else }} 35 - <!-- Home Page / Default --> 36 - <meta property="og:title" content="ATCR - Distributed Container Registry"> 37 - <meta property="og:description" content="Push and pull Docker images on the AT Protocol"> 38 - <meta property="og:image" content="{{ .RegistryURL }}/web-app-manifest-512x512.png"> 39 - <meta property="og:type" content="website"> 40 - <meta property="og:url" content="{{ .RegistryURL }}"> 41 - {{ end }} 6 + <meta property="og:title" content="{{ .OGTitle }}"> 7 + <meta property="og:description" content="{{ .OGDescription }}"> 8 + <meta property="og:image" content="{{ .OGImage }}"> 9 + <meta property="og:type" content="{{ .OGType }}"> 10 + <meta property="og:url" content="{{ .OGURL }}"> 42 11 <meta property="og:site_name" content="ATCR"> 43 12 44 13 <!-- Favicons -->