Compare commits

...

3 Commits

Author SHA1 Message Date
Asaf Gartner 587ac7643f Merge branch 'master' into beta 2022-12-03 18:45:58 +02:00
Ben Visness 5fe3e7560c A little more OpenGraph flavor 2022-11-05 16:27:55 -05:00
Ben Visness 084b13ae34 ...including the nav and stuff 2022-11-05 16:23:12 -05:00
8 changed files with 11 additions and 37 deletions

View File

@ -701,18 +701,11 @@ func (c *UrlContext) BuildBlogPostReply(threadId int, postId int) string {
} }
/* /*
* Library * Library (old)
*/ */
var RegexLibraryAny = regexp.MustCompile(`^/library`) var RegexLibraryAny = regexp.MustCompile(`^/library`)
var RegexLibrary = regexp.MustCompile(`^/library$`)
func BuildLibrary() string {
defer CatchPanic()
return Url("/library", nil)
}
/* /*
* Episode Guide * Episode Guide
*/ */

View File

@ -84,10 +84,7 @@
<div class="root-item"> <div class="root-item">
<a>Resources <div class="dib svgicon ml1">{{ svg "chevron-down-thick" }}</div></a> <a>Resources <div class="dib svgicon ml1">{{ svg "chevron-down-thick" }}</div></a>
<div class="submenu b--theme-dark"> <div class="submenu b--theme-dark">
<a href="{{ .Header.LibraryUrl }}">Library</a>
{{ if and .User .User.IsEduTester }}
<a href="{{ .Header.EducationUrl }}">Education</a> <a href="{{ .Header.EducationUrl }}">Education</a>
{{ end }}
</div> </div>
</div> </div>
</div> </div>

View File

@ -1,8 +0,0 @@
{{ template "base.html" . }}
{{ define "content" }}
<div class="center ph2 pv5">
<h2>The library is coming back soon.</h2>
<p>The previous library wasn't everything we wanted it to be. Watch this space.</p>
</div>
{{ end }}

View File

@ -52,7 +52,6 @@ type Header struct {
FishbowlUrl string FishbowlUrl string
ForumsUrl string ForumsUrl string
ConferencesUrl string ConferencesUrl string
LibraryUrl string
EducationUrl string EducationUrl string
Project *ProjectHeader Project *ProjectHeader

View File

@ -12,6 +12,7 @@ func getBaseDataAutocrumb(c *RequestContext, title string) templates.BaseData {
} }
// NOTE(asaf): If you set breadcrumbs, the breadcrumb for the current project will automatically be prepended when necessary. // NOTE(asaf): If you set breadcrumbs, the breadcrumb for the current project will automatically be prepended when necessary.
//
// If you pass nil, no breadcrumbs will be created. // If you pass nil, no breadcrumbs will be created.
func getBaseData(c *RequestContext, title string, breadcrumbs []templates.Breadcrumb) templates.BaseData { func getBaseData(c *RequestContext, title string, breadcrumbs []templates.Breadcrumb) templates.BaseData {
var project models.Project var project models.Project
@ -75,7 +76,6 @@ func getBaseData(c *RequestContext, title string, breadcrumbs []templates.Breadc
FishbowlUrl: hmnurl.BuildFishbowlIndex(), FishbowlUrl: hmnurl.BuildFishbowlIndex(),
ForumsUrl: hmnurl.HMNProjectContext.BuildForum(nil, 1), ForumsUrl: hmnurl.HMNProjectContext.BuildForum(nil, 1),
ConferencesUrl: hmnurl.BuildConferences(), ConferencesUrl: hmnurl.BuildConferences(),
LibraryUrl: hmnurl.BuildLibrary(),
EducationUrl: hmnurl.BuildEducationIndex(), EducationUrl: hmnurl.BuildEducationIndex(),
}, },
Footer: templates.Footer{ Footer: templates.Footer{

View File

@ -91,6 +91,9 @@ func EducationIndex(c *RequestContext) ResponseData {
NewArticleUrl: hmnurl.BuildEducationArticleNew(), NewArticleUrl: hmnurl.BuildEducationArticleNew(),
RerenderUrl: hmnurl.BuildEducationRerender(), RerenderUrl: hmnurl.BuildEducationRerender(),
} }
tmpl.OpenGraphItems = append(tmpl.OpenGraphItems, templates.OpenGraphItem{
Property: "og:description", Value: "Learn the Handmade way with our curated articles on a variety of topics.",
})
var res ResponseData var res ResponseData
res.MustWriteTemplate("education_index.html", tmpl, c.Perf) res.MustWriteTemplate("education_index.html", tmpl, c.Perf)

View File

@ -1,9 +0,0 @@
package website
func LibraryNotPortedYet(c *RequestContext) ResponseData {
baseData := getBaseData(c, "Library", nil)
var res ResponseData
res.MustWriteTemplate("library_not_ported_yet.html", baseData, c.Perf)
return res
}

View File

@ -118,7 +118,7 @@ func NewWebsiteRoutes(conn *pgxpool.Pool) http.Handler {
hmnOnly.GET(hmnurl.RegexFishbowl, Fishbowl) hmnOnly.GET(hmnurl.RegexFishbowl, Fishbowl)
hmnOnly.GET(hmnurl.RegexEducationIndex, EducationIndex) hmnOnly.GET(hmnurl.RegexEducationIndex, EducationIndex)
hmnOnly.GET(hmnurl.RegexEducationGlossary, EducationGlossary) hmnOnly.GET(hmnurl.RegexEducationGlossary, educationAuthorsOnly(EducationGlossary)) // TODO: Remove this gate
hmnOnly.GET(hmnurl.RegexEducationArticleNew, educationAuthorsOnly(EducationArticleNew)) hmnOnly.GET(hmnurl.RegexEducationArticleNew, educationAuthorsOnly(EducationArticleNew))
hmnOnly.POST(hmnurl.RegexEducationArticleNew, educationAuthorsOnly(EducationArticleNewSubmit)) hmnOnly.POST(hmnurl.RegexEducationArticleNew, educationAuthorsOnly(EducationArticleNewSubmit))
hmnOnly.GET(hmnurl.RegexEducationRerender, educationAuthorsOnly(EducationRerender)) hmnOnly.GET(hmnurl.RegexEducationRerender, educationAuthorsOnly(EducationRerender))
@ -130,10 +130,9 @@ func NewWebsiteRoutes(conn *pgxpool.Pool) http.Handler {
hmnOnly.POST(hmnurl.RegexAPICheckUsername, csrfMiddleware(APICheckUsername)) hmnOnly.POST(hmnurl.RegexAPICheckUsername, csrfMiddleware(APICheckUsername))
hmnOnly.GET(hmnurl.RegexLibraryAny, LibraryNotPortedYet) hmnOnly.GET(hmnurl.RegexLibraryAny, func(c *RequestContext) ResponseData {
// hmnOnly.GET(hmnurl.RegexLibraryAny, func(c *RequestContext) ResponseData { return c.Redirect(hmnurl.BuildEducationIndex(), http.StatusFound)
// return c.Redirect(hmnurl.BuildEducationIndex(), http.StatusFound) })
// })
// Project routes can appear either at the root (e.g. hero.handmade.network/edit) // Project routes can appear either at the root (e.g. hero.handmade.network/edit)
// or on a personal project path (e.g. handmade.network/p/123/hero/edit). So, we // or on a personal project path (e.g. handmade.network/p/123/hero/edit). So, we