diff --git a/backlinks/web.go b/backlinks/web.go index 278b936..f79edd3 100644 --- a/backlinks/web.go +++ b/backlinks/web.go @@ -51,6 +51,7 @@ func viewBacklinks(meta viewutil.Meta, hyphaName string, backlinks []string) { if err := chain.Get(meta).ExecuteTemplate(meta.W, "page", backlinksData{ BaseData: viewutil.BaseData{ Meta: meta, + Addr: "/backlinks/" + hyphaName, HeaderLinks: cfg.HeaderLinks, CommonScripts: cfg.CommonScripts, }, diff --git a/categories/views.go b/categories/views.go index 3401f2d..53c7e16 100644 --- a/categories/views.go +++ b/categories/views.go @@ -53,9 +53,9 @@ type cardData struct { func CategoryCard(meta viewutil.Meta, hyphaName string) string { var buf strings.Builder err := viewCardChain.Get(meta).ExecuteTemplate(&buf, "category card", cardData{ - hyphaName, - categoriesWithHypha(hyphaName), - meta.U.CanProceed("add-to-category"), + HyphaName: hyphaName, + Categories: categoriesWithHypha(hyphaName), + GivenPermissionToModify: meta.U.CanProceed("add-to-category"), }) if err != nil { log.Println(err) @@ -76,6 +76,7 @@ func categoryPage(meta viewutil.Meta, catName string) { Meta: meta, HeaderLinks: cfg.HeaderLinks, CommonScripts: cfg.CommonScripts, + Addr: "/category/" + catName, }, CatName: catName, Hyphae: hyphaeInCategory(catName), diff --git a/help/web.go b/help/web.go index a717435..3466373 100644 --- a/help/web.go +++ b/help/web.go @@ -73,12 +73,12 @@ func handlerHelp(w http.ResponseWriter, rq *http.Request) { content, err := Get(articlePath) if err != nil && strings.HasPrefix(err.Error(), "open") { w.WriteHeader(http.StatusNotFound) - viewHelp(meta, lang, "") + viewHelp(meta, lang, "", articlePath) return } if err != nil { w.WriteHeader(http.StatusInternalServerError) - viewHelp(meta, lang, err.Error()) + viewHelp(meta, lang, err.Error(), articlePath) return } @@ -87,7 +87,7 @@ func handlerHelp(w http.ResponseWriter, rq *http.Request) { ast := mycomarkup.BlockTree(ctx) result := mycomarkup.BlocksToHTML(ctx, ast) w.WriteHeader(http.StatusOK) - viewHelp(meta, lang, result) + viewHelp(meta, lang, result, articlePath) } type helpData struct { @@ -96,12 +96,13 @@ type helpData struct { Lang string } -func viewHelp(meta viewutil.Meta, lang, contentsHTML string) { +func viewHelp(meta viewutil.Meta, lang, contentsHTML, articlePath string) { if err := chain.Get(meta).ExecuteTemplate(meta.W, "page", helpData{ BaseData: viewutil.BaseData{ Meta: meta, HeaderLinks: cfg.HeaderLinks, CommonScripts: cfg.CommonScripts, + Addr: "/help/" + articlePath, }, ContentsHTML: contentsHTML, Lang: lang, diff --git a/viewutil/base.html b/viewutil/base.html index cfac78b..64f49fb 100644 --- a/viewutil/base.html +++ b/viewutil/base.html @@ -10,7 +10,7 @@ {{range .HeadElements}}{{.}}{{end}} - +