diff --git a/routers/web/pages/pages.go b/routers/web/pages/pages.go index a2dac37082..09280312ea 100644 --- a/routers/web/pages/pages.go +++ b/routers/web/pages/pages.go @@ -188,6 +188,14 @@ func setupLandingPageContext(ctx *context.Context, repo *repo_model.Repository, if ctx.Repo == nil || ctx.Repo.Repository == nil { ctx.Data["SocialPreviewURL"] = pageBase + "/social-preview.png" } + // LandingURL is the base path for the landing page — used by nav anchor links + // so they resolve correctly from blog detail/list pages. + if ctx.Repo != nil && ctx.Repo.Repository != nil { + ctx.Data["LandingURL"] = fmt.Sprintf("/%s/%s/pages", repo.OwnerName, repo.Name) + } else { + ctx.Data["LandingURL"] = "/" + } + ctx.Data["NumStars"] = repo.NumStars ctx.Data["NumForks"] = repo.NumForks ctx.Data["Year"] = time.Now().Year() diff --git a/templates/pages/architecture-deep-dive.tmpl b/templates/pages/architecture-deep-dive.tmpl index 59bfd80eb7..e1d17f021d 100644 --- a/templates/pages/architecture-deep-dive.tmpl +++ b/templates/pages/architecture-deep-dive.tmpl @@ -992,7 +992,7 @@