Skip to content

Commit 3ad5105

Browse files
authored
feat(docs): sitemap with links for headers (antoniomika#292)
1 parent c64d009 commit 3ad5105

2 files changed

Lines changed: 36 additions & 28 deletions

File tree

docs/cmd/ssg.go

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ func main() {
1515
Page: pager("getting-started.md"),
1616
Tag: "Help",
1717
Children: []*pdocs.Sitemap{
18-
{Text: "Managed"},
19-
{Text: "DNS"},
20-
{Text: "Docker Compose"},
21-
{Text: "Docker"},
22-
{Text: "Google Cloud Platform"},
23-
{Text: "Authentication"},
18+
{Text: "Managed", Href: "#managed"},
19+
{Text: "DNS", Href: "#dns"},
20+
{Text: "Docker Compose", Href: "#docker-compose"},
21+
{Text: "Docker", Href: "#docker"},
22+
{Text: "Google Cloud Platform", Href: "#google-cloud-platform"},
23+
{Text: "Authentication", Href: "#authentication"},
2424
},
2525
},
2626
{
@@ -29,11 +29,10 @@ func main() {
2929
Page: pager("how-it-works.md"),
3030
Tag: "Help",
3131
Children: []*pdocs.Sitemap{
32-
{Text: "Port Forward"},
33-
{Text: "Traditional VPN"},
34-
{Text: "sish Public"},
35-
{Text: "sish Private"},
36-
{Text: "Additional Details"},
32+
{Text: "Port Forward", Href: "#port-forward"},
33+
{Text: "Traditional VPN", Href: "#traditional-vpn"},
34+
{Text: "sish Public", Href: "#sish-public"},
35+
{Text: "sish Private", Href: "#sish-private"},
3736
},
3837
},
3938
{
@@ -42,10 +41,10 @@ func main() {
4241
Page: pager("forwarding-types.md"),
4342
Tag: "Help",
4443
Children: []*pdocs.Sitemap{
45-
{Text: "HTTP"},
46-
{Text: "TCP"},
47-
{Text: "TCP Alias"},
48-
{Text: "SNI"},
44+
{Text: "HTTP", Href: "#href"},
45+
{Text: "TCP", Href: "#tcp"},
46+
{Text: "TCP Alias", Href: "#tcp-alias"},
47+
{Text: "SNI", Href: "#sni"},
4948
},
5049
},
5150
{
@@ -54,13 +53,13 @@ func main() {
5453
Page: pager("cheatsheet.md"),
5554
Tag: "Help",
5655
Children: []*pdocs.Sitemap{
57-
{Text: "Remote forward SSH tunnels"},
58-
{Text: "Local forward SSH tunnels"},
59-
{Text: "HTTPS public access"},
60-
{Text: "HTTPS private access"},
61-
{Text: "Websocket"},
62-
{Text: "TCP public access"},
63-
{Text: "TCP private access"},
56+
{Text: "Remote forward SSH tunnels", Href: "#remote-forward-ssh-tunnels"},
57+
{Text: "Local forward SSH tunnels", Href: "#local-foward-ssh-tunnels"},
58+
{Text: "HTTPS public access", Href: "#https-public-access"},
59+
{Text: "HTTPS private access", Href: "#https-private-access"},
60+
{Text: "Websocket", Href: "#websocket"},
61+
{Text: "TCP public access", Href: "#tcp-public-access"},
62+
{Text: "TCP private access", Href: "#tcp-private-access"},
6463
},
6564
},
6665
{Text: "CLI", Href: "/cli", Page: pager("cli.md"), Tag: "CLI"},
@@ -69,11 +68,11 @@ func main() {
6968
Href: "/advanced",
7069
Page: pager("advanced.md"),
7170
Children: []*pdocs.Sitemap{
72-
{Text: "Choose your own subdomain"},
73-
{Text: "Websocket Support"},
74-
{Text: "Allowlist IPs"},
75-
{Text: "Custom Domains"},
76-
{Text: "Load Balancing"},
71+
{Text: "Choose your own subdomain", Href: "#choose-your-own-subdomain"},
72+
{Text: "Websocket Support", Href: "#websocket-support"},
73+
{Text: "Allowlist IPs", Href: "#allowlist-ips"},
74+
{Text: "Custom Domains", Href: "#custom-domains"},
75+
{Text: "Load Balancing", Href: "#load-balancing"},
7776
},
7877
Tag: "Help",
7978
},

docs/tmpl/toc.partial.tmpl

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,16 @@
55
<h2 class="text-xl">{{$key}}</h2>
66
<ul>
77
{{range $value}}
8-
<li><a href="{{.GenHref}}">{{.Text}}</a></li>
8+
<li>
9+
<a href="{{.GenHref}}">{{.Text}}</a>
10+
{{if .Children}}
11+
<ul>
12+
{{range .Children}}
13+
<li><a href="{{.ParentHref}}{{.GenHref}}">{{.Text}}</a></li>
14+
{{end}}
15+
</ul>
16+
{{end}}
17+
</li>
918
{{end}}
1019
</ul>
1120
</div>

0 commit comments

Comments
 (0)