Backport #29669 by @ankitrgadiya The internal links to other files in the repository were not rendering with the Src Prefix (/src/branch-name/file-path). This commit fixes that by using the `SrcLink` as base if available. Resolves #29668 Co-authored-by: Ankit R Gadiya <git@argp.in>
This commit is contained in:
parent
e8b6d28ab9
commit
93e105a228
2 changed files with 40 additions and 6 deletions
|
@ -143,10 +143,18 @@ func (r *Writer) resolveLink(kind, link string) string {
|
|||
// so we need to try to guess the link kind again here
|
||||
kind = org.RegularLink{URL: link}.Kind()
|
||||
}
|
||||
|
||||
base := r.Ctx.Links.Base
|
||||
if r.Ctx.IsWiki {
|
||||
base = r.Ctx.Links.WikiLink()
|
||||
} else if r.Ctx.Links.HasBranchInfo() {
|
||||
base = r.Ctx.Links.SrcLink()
|
||||
}
|
||||
|
||||
if kind == "image" || kind == "video" {
|
||||
base = r.Ctx.Links.ResolveMediaLink(r.Ctx.IsWiki)
|
||||
}
|
||||
|
||||
link = util.URLJoin(base, link)
|
||||
}
|
||||
return link
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue