diff options
| author | Abhinav Gupta <mail@abhinavg.net> | 2023-10-18 15:18:40 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-10-18 15:18:40 -0700 |
| commit | 5fbb57ed966154dc29730e0ce62824e1b577d8cb (patch) | |
| tree | cbbb4cae3d3932f1122d799cd541f217e0323057 /templates | |
| parent | f3a3b27cdf92312dad52406c6233cccab310e110 (diff) | |
| download | sally-5fbb57ed966154dc29730e0ce62824e1b577d8cb.tar.gz | |
Add support for sub-indexes (#120)
<details>
<summary>Background</summary>
Sally renders two kinds of pages:
- packages: These are for packages defined in sally.yaml
and any route under the package path.
- indexes: These list available packages.
The latter--indexes was previously only supported at '/', the root page.
This leads to a slight UX issue:
if you have a package with a / in its name (e.g. net/metrics):
- example.com/net/metrics gives you the package page
- example.com/ lists net/metrics
- However, example.com/net fails with a 404
</details>
This adds support for index pages on all parents of package pages.
Therefore, if example.com/net/metrics exists,
example.com/net will list all packages defined under that path.
Resolves #31
Diffstat (limited to '')
| -rw-r--r-- | templates/index.html | 6 | ||||
| -rw-r--r-- | templates/package.html | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/templates/index.html b/templates/index.html index fa061f1..7ffc1a6 100644 --- a/templates/index.html +++ b/templates/index.html @@ -29,15 +29,15 @@ <div class="row"> <div class="five columns"> <span class="inline-header">Package:</span> - {{ .ImportPath }} + {{ .ModulePath }} </div> <div class="five columns"> <span class="inline-header">Source:</span> <a href="//{{ .GitURL }}">{{ .GitURL }}</a> </div> <div class="two columns"> - <a href="//{{ .GodocHome }}"> - <img src="//pkg.go.dev/badge/{{ .ImportPath }}.svg" alt="Go Reference" /> + <a href="//{{ .DocURL }}"> + <img src="//pkg.go.dev/badge/{{ .ModulePath }}.svg" alt="Go Reference" /> </a> </div> </div> diff --git a/templates/package.html b/templates/package.html index a85ff77..bd56c38 100644 --- a/templates/package.html +++ b/templates/package.html @@ -1,10 +1,10 @@ <!DOCTYPE html> <html> <head> - <meta name="go-import" content="{{ .CanonicalURL }} git https://{{ .Repo }}"> - <meta http-equiv="refresh" content="0; url={{ .GodocURL }}"> + <meta name="go-import" content="{{ .ModulePath }} git https://{{ .GitURL }}"> + <meta http-equiv="refresh" content="0; url={{ .DocURL }}"> </head> <body> - Nothing to see here. Please <a href="{{ .GodocURL }}">move along</a>. + Nothing to see here. Please <a href="{{ .DocURL }}">move along</a>. </body> </html> |