Skip to content

Commit

Permalink
feat(docs): sitemap with links for headers (#292)
Browse files Browse the repository at this point in the history
  • Loading branch information
neurosnap authored Feb 13, 2024
1 parent c64d009 commit 3ad5105
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 28 deletions.
53 changes: 26 additions & 27 deletions docs/cmd/ssg.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ func main() {
Page: pager("getting-started.md"),
Tag: "Help",
Children: []*pdocs.Sitemap{
{Text: "Managed"},
{Text: "DNS"},
{Text: "Docker Compose"},
{Text: "Docker"},
{Text: "Google Cloud Platform"},
{Text: "Authentication"},
{Text: "Managed", Href: "#managed"},
{Text: "DNS", Href: "#dns"},
{Text: "Docker Compose", Href: "#docker-compose"},
{Text: "Docker", Href: "#docker"},
{Text: "Google Cloud Platform", Href: "#google-cloud-platform"},
{Text: "Authentication", Href: "#authentication"},
},
},
{
Expand All @@ -29,11 +29,10 @@ func main() {
Page: pager("how-it-works.md"),
Tag: "Help",
Children: []*pdocs.Sitemap{
{Text: "Port Forward"},
{Text: "Traditional VPN"},
{Text: "sish Public"},
{Text: "sish Private"},
{Text: "Additional Details"},
{Text: "Port Forward", Href: "#port-forward"},
{Text: "Traditional VPN", Href: "#traditional-vpn"},
{Text: "sish Public", Href: "#sish-public"},
{Text: "sish Private", Href: "#sish-private"},
},
},
{
Expand All @@ -42,10 +41,10 @@ func main() {
Page: pager("forwarding-types.md"),
Tag: "Help",
Children: []*pdocs.Sitemap{
{Text: "HTTP"},
{Text: "TCP"},
{Text: "TCP Alias"},
{Text: "SNI"},
{Text: "HTTP", Href: "#href"},
{Text: "TCP", Href: "#tcp"},
{Text: "TCP Alias", Href: "#tcp-alias"},
{Text: "SNI", Href: "#sni"},
},
},
{
Expand All @@ -54,13 +53,13 @@ func main() {
Page: pager("cheatsheet.md"),
Tag: "Help",
Children: []*pdocs.Sitemap{
{Text: "Remote forward SSH tunnels"},
{Text: "Local forward SSH tunnels"},
{Text: "HTTPS public access"},
{Text: "HTTPS private access"},
{Text: "Websocket"},
{Text: "TCP public access"},
{Text: "TCP private access"},
{Text: "Remote forward SSH tunnels", Href: "#remote-forward-ssh-tunnels"},
{Text: "Local forward SSH tunnels", Href: "#local-foward-ssh-tunnels"},
{Text: "HTTPS public access", Href: "#https-public-access"},
{Text: "HTTPS private access", Href: "#https-private-access"},
{Text: "Websocket", Href: "#websocket"},
{Text: "TCP public access", Href: "#tcp-public-access"},
{Text: "TCP private access", Href: "#tcp-private-access"},
},
},
{Text: "CLI", Href: "/cli", Page: pager("cli.md"), Tag: "CLI"},
Expand All @@ -69,11 +68,11 @@ func main() {
Href: "/advanced",
Page: pager("advanced.md"),
Children: []*pdocs.Sitemap{
{Text: "Choose your own subdomain"},
{Text: "Websocket Support"},
{Text: "Allowlist IPs"},
{Text: "Custom Domains"},
{Text: "Load Balancing"},
{Text: "Choose your own subdomain", Href: "#choose-your-own-subdomain"},
{Text: "Websocket Support", Href: "#websocket-support"},
{Text: "Allowlist IPs", Href: "#allowlist-ips"},
{Text: "Custom Domains", Href: "#custom-domains"},
{Text: "Load Balancing", Href: "#load-balancing"},
},
Tag: "Help",
},
Expand Down
11 changes: 10 additions & 1 deletion docs/tmpl/toc.partial.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,16 @@
<h2 class="text-xl">{{$key}}</h2>
<ul>
{{range $value}}
<li><a href="{{.GenHref}}">{{.Text}}</a></li>
<li>
<a href="{{.GenHref}}">{{.Text}}</a>
{{if .Children}}
<ul>
{{range .Children}}
<li><a href="{{.ParentHref}}{{.GenHref}}">{{.Text}}</a></li>
{{end}}
</ul>
{{end}}
</li>
{{end}}
</ul>
</div>
Expand Down

0 comments on commit 3ad5105

Please sign in to comment.