diff --git a/internal/handlers/profile.go b/internal/handlers/profile.go index 067f3d3..4deeb3e 100644 --- a/internal/handlers/profile.go +++ b/internal/handlers/profile.go @@ -493,9 +493,9 @@ func (h *Handler) HandleProfile(w http.ResponseWriter, r *http.Request) { } // Create layout data - pageTitle := "Profile" + pageTitle := "@" + viewedProfile.Handle if viewedProfile.DisplayName != "" { - pageTitle = viewedProfile.DisplayName + " - Profile" + pageTitle = viewedProfile.DisplayName + " (@" + viewedProfile.Handle + ")" } layoutData, _, _ := h.layoutDataFromRequest(r, pageTitle) @@ -672,18 +672,18 @@ func (h *Handler) HandleProfilePartial(w http.ResponseWriter, r *http.Request) { } if err := components.ProfileContentPartial(components.ProfileContentPartialProps{ - Brews: profileData.Brews, - Beans: profileData.Beans, - Roasters: profileData.Roasters, - Grinders: profileData.Grinders, - Brewers: profileData.Brewers, - IsOwnProfile: isOwnProfile, - ProfileHandle: profileHandle, - Profile: profile, - BrewLikeCounts: brewLikeCounts, - BrewLikedByUser: brewLikedByUser, - BrewCIDs: brewCIDs, - IsAuthenticated: isAuthenticated, + Brews: profileData.Brews, + Beans: profileData.Beans, + Roasters: profileData.Roasters, + Grinders: profileData.Grinders, + Brewers: profileData.Brewers, + IsOwnProfile: isOwnProfile, + ProfileHandle: profileHandle, + Profile: profile, + BrewLikeCounts: brewLikeCounts, + BrewLikedByUser: brewLikedByUser, + BrewCIDs: brewCIDs, + IsAuthenticated: isAuthenticated, BeanBrewCounts: beanBrewCounts, GrinderBrewCounts: grinderBrewCounts, BrewerBrewCounts: brewerBrewCounts, diff --git a/internal/web/components/layout.templ b/internal/web/components/layout.templ index 9cc7acf..06c9c20 100644 --- a/internal/web/components/layout.templ +++ b/internal/web/components/layout.templ @@ -26,6 +26,14 @@ func (d *LayoutData) ogTitle() string { if d.OGTitle != "" { return d.OGTitle } + return d.pageTitle() +} + +// pageTitle returns the text, collapsing the home page to just "Arabica" +func (d *LayoutData) pageTitle() string { + if d.Title == "" || d.Title == "Home" { + return "Arabica" + } return d.Title + " - Arabica" } @@ -103,7 +111,7 @@ templ Layout(data *LayoutData, content templ.Component) { } <meta name="theme-color" content="#4a2c2a" media="(prefers-color-scheme: light)"/> <meta name="theme-color" content="#0F0A08" media="(prefers-color-scheme: dark)"/> - <title>{ data.Title } - Arabica + { data.pageTitle() }