mirror of https://github.com/jlelse/GoBlog
Fix
This commit is contained in:
parent
a2f5ddbdcf
commit
eb9a842a40
|
@ -409,7 +409,7 @@ func (a *goBlog) apNewID(blog *configBlog) (hash string, url string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *goBlog) apIri(b *configBlog) string {
|
func (a *goBlog) apIri(b *configBlog) string {
|
||||||
return a.getFullAddress(b.Path)
|
return a.getFullAddress(b.getRelativePath(""))
|
||||||
}
|
}
|
||||||
|
|
||||||
func apRequestIsSuccess(code int) bool {
|
func apRequestIsSuccess(code int) bool {
|
||||||
|
|
7
http.go
7
http.go
|
@ -509,9 +509,10 @@ func (a *goBlog) buildDynamicRouter() (*chi.Mux, error) {
|
||||||
r.Group(func(r chi.Router) {
|
r.Group(func(r chi.Router) {
|
||||||
r.Use(a.privateModeHandler...)
|
r.Use(a.privateModeHandler...)
|
||||||
r.Use(sbm)
|
r.Use(sbm)
|
||||||
r.With(a.checkActivityStreamsRequest, a.cache.cacheMiddleware).Get(blogConfig.Path, a.serveHome)
|
blogBasePath := blogConfig.getRelativePath("")
|
||||||
r.With(a.cache.cacheMiddleware).Get(blogConfig.getRelativePath(feedPath), a.serveHome)
|
r.With(a.checkActivityStreamsRequest, a.cache.cacheMiddleware).Get(blogBasePath, a.serveHome)
|
||||||
r.With(a.cache.cacheMiddleware).Get(blogConfig.getRelativePath(paginationPath), a.serveHome)
|
r.With(a.cache.cacheMiddleware).Get(blogBasePath+feedPath, a.serveHome)
|
||||||
|
r.With(a.cache.cacheMiddleware).Get(blogBasePath+paginationPath, a.serveHome)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
posts.go
2
posts.go
|
@ -65,7 +65,7 @@ func (a *goBlog) servePost(w http.ResponseWriter, r *http.Request) {
|
||||||
canonical = a.fullPostURL(p)
|
canonical = a.fullPostURL(p)
|
||||||
}
|
}
|
||||||
template := templatePost
|
template := templatePost
|
||||||
if p.Path == a.cfg.Blogs[p.Blog].Path {
|
if p.Path == a.getRelativePath(p.Blog, "") {
|
||||||
template = templateStaticHome
|
template = templateStaticHome
|
||||||
}
|
}
|
||||||
w.Header().Add("Link", fmt.Sprintf("<%s>; rel=shortlink", a.shortPostURL(p)))
|
w.Header().Add("Link", fmt.Sprintf("<%s>; rel=shortlink", a.shortPostURL(p)))
|
||||||
|
|
|
@ -89,7 +89,7 @@ func (a *goBlog) checkPost(p *post) (err error) {
|
||||||
}
|
}
|
||||||
var pathBuffer bytes.Buffer
|
var pathBuffer bytes.Buffer
|
||||||
err = pathTmpl.Execute(&pathBuffer, map[string]interface{}{
|
err = pathTmpl.Execute(&pathBuffer, map[string]interface{}{
|
||||||
"BlogPath": a.cfg.Blogs[p.Blog].Path,
|
"BlogPath": a.getRelativePath(p.Blog, ""),
|
||||||
"Year": published.Year(),
|
"Year": published.Year(),
|
||||||
"Month": int(published.Month()),
|
"Month": int(published.Month()),
|
||||||
"Day": published.Day(),
|
"Day": published.Day(),
|
||||||
|
|
|
@ -18,7 +18,7 @@ func (a *goBlog) serveSitemap(w http.ResponseWriter, r *http.Request) {
|
||||||
for b, bc := range a.cfg.Blogs {
|
for b, bc := range a.cfg.Blogs {
|
||||||
// Blog
|
// Blog
|
||||||
sm.Add(&sitemap.URL{
|
sm.Add(&sitemap.URL{
|
||||||
Loc: a.getFullAddress(bc.Path),
|
Loc: a.getFullAddress(bc.getRelativePath("")),
|
||||||
})
|
})
|
||||||
// Sections
|
// Sections
|
||||||
for _, section := range bc.Sections {
|
for _, section := range bc.Sections {
|
||||||
|
|
Loading…
Reference in New Issue