pull/7/head
Jan-Lukas Else 1 year ago
parent a2f5ddbdcf
commit eb9a842a40
  1. 2
      activityPub.go
  2. 7
      http.go
  3. 2
      posts.go
  4. 2
      postsDb.go
  5. 2
      sitemap.go

@ -409,7 +409,7 @@ func (a *goBlog) apNewID(blog *configBlog) (hash string, url string) {
}
func (a *goBlog) apIri(b *configBlog) string {
return a.getFullAddress(b.Path)
return a.getFullAddress(b.getRelativePath(""))
}
func apRequestIsSuccess(code int) bool {

@ -509,9 +509,10 @@ func (a *goBlog) buildDynamicRouter() (*chi.Mux, error) {
r.Group(func(r chi.Router) {
r.Use(a.privateModeHandler...)
r.Use(sbm)
r.With(a.checkActivityStreamsRequest, a.cache.cacheMiddleware).Get(blogConfig.Path, a.serveHome)
r.With(a.cache.cacheMiddleware).Get(blogConfig.getRelativePath(feedPath), a.serveHome)
r.With(a.cache.cacheMiddleware).Get(blogConfig.getRelativePath(paginationPath), a.serveHome)
blogBasePath := blogConfig.getRelativePath("")
r.With(a.checkActivityStreamsRequest, a.cache.cacheMiddleware).Get(blogBasePath, a.serveHome)
r.With(a.cache.cacheMiddleware).Get(blogBasePath+feedPath, a.serveHome)
r.With(a.cache.cacheMiddleware).Get(blogBasePath+paginationPath, a.serveHome)
})
}

@ -65,7 +65,7 @@ func (a *goBlog) servePost(w http.ResponseWriter, r *http.Request) {
canonical = a.fullPostURL(p)
}
template := templatePost
if p.Path == a.cfg.Blogs[p.Blog].Path {
if p.Path == a.getRelativePath(p.Blog, "") {
template = templateStaticHome
}
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
err = pathTmpl.Execute(&pathBuffer, map[string]interface{}{
"BlogPath": a.cfg.Blogs[p.Blog].Path,
"BlogPath": a.getRelativePath(p.Blog, ""),
"Year": published.Year(),
"Month": int(published.Month()),
"Day": published.Day(),

@ -18,7 +18,7 @@ func (a *goBlog) serveSitemap(w http.ResponseWriter, r *http.Request) {
for b, bc := range a.cfg.Blogs {
// Blog
sm.Add(&sitemap.URL{
Loc: a.getFullAddress(bc.Path),
Loc: a.getFullAddress(bc.getRelativePath("")),
})
// Sections
for _, section := range bc.Sections {

Loading…
Cancel
Save