Skip to content

Commit 806cdd5

Browse files
authored
feat(godocfx): include alt documentation link (#3530)
1 parent ab2af0b commit 806cdd5

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

internal/godocfx/parse.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ type item struct {
8383
Syntax syntax `yaml:"syntax,omitempty"`
8484
Examples []example `yaml:"codeexamples,omitempty"`
8585
Children []child `yaml:"children,omitempty"`
86+
AltLink string `yaml:"alt_link,omitempty"`
8687
}
8788

8889
func (p *page) addItem(i *item) {
@@ -156,6 +157,7 @@ func parse(glob string, workingDir string, optionalExtraFiles []string) (*result
156157
Langs: onlyGo,
157158
Type: "package",
158159
Examples: processExamples(pi.doc.Examples, pi.fset),
160+
AltLink: "https://pkg.go.dev/" + pi.doc.ImportPath,
159161
}
160162
pkgPage := &page{Items: []*item{pkgItem}}
161163
pages[pi.doc.ImportPath] = pkgPage

internal/godocfx/testdata/golden/index.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ items:
231231
- cloud.google.com/go/storage.Writer.CloseWithError
232232
- cloud.google.com/go/storage.Writer.Write
233233
- cloud.google.com/go/storage.SignedURL
234+
alt_link: https://pkg.go.dev/cloud.google.com/go/storage
234235
- uid: cloud.google.com/go/storage.DeleteAction,SetStorageClassAction
235236
name: DeleteAction, SetStorageClassAction
236237
id: DeleteAction,SetStorageClassAction

0 commit comments

Comments
 (0)