do not change the link in the content menu

Signed-off-by: Avelino <avelinorun@gmail.com>
This commit is contained in:
Avelino 2022-03-14 15:40:51 -03:00
parent 9739a7b58f
commit 35ef3dda5f
No known key found for this signature in database
GPG Key ID: B345B4D52E98180A
2 changed files with 16 additions and 4 deletions

View File

@ -104,8 +104,9 @@ func changeLinksInIndex(html string, query *goquery.Document) {
href, exists := s.Attr("href")
if exists {
uri := strings.SplitAfter(href, "#")
if len(uri) >= 2 {
html = strings.ReplaceAll(html, fmt.Sprintf(`href="%s"`, href), fmt.Sprintf(`href="%s"`, uri[1]))
if len(uri) >= 2 && uri[1] != "contents" {
html = strings.ReplaceAll(
html, fmt.Sprintf(`href="%s"`, href), fmt.Sprintf(`href="%s"`, uri[1]))
}
}
})

15
tmpl/cat-tmpl.html vendored
View File

@ -55,7 +55,18 @@
<script async src="//z-na.amazon-adsystem.com/widgets/onejs?MarketPlace=US&adInstanceId=ce1dd292-c6f0-4062-ac99-55bc005bbbf9"></script>
</p>
<p>
<a href="https://www.doppler.com/?utm_campaign=github_repo&amp;utm_medium=referral&amp;utm_content=awesomego&amp;utm_source=github"><img src="https://github.com/avelino/awesome-go/raw/main/tmpl/assets/sponsors/doppler.png" alt="Doppler"></a>
<a href="https://www.doppler.com/?utm_campaign=github_repo&amp;utm_medium=referral&amp;utm_content=awesomego&amp;utm_source=github">
<img src="https://github.com/avelino/awesome-go/raw/main/tmpl/assets/sponsors/doppler.png" alt="Doppler">
<br />
<b>Quit struggling with scattered API keys and access controls.</b>
</a>
</p>
<p>
<a href="https://bit.ly/awesome-go-xteam">
<img src="https://avelino.run/sponsors/xteam-logo.png" width="200" alt="x-team">
<br />
<b>Work from anywhere in the world with top tech companies like Riot Games, Coinbase, and Google.</b>
</a>
</p>
<p>
<a href="https://m.do.co/c/bd3b723c0a36?utm_medium=opensource&amp;utm_source=awesome-go"><img src="https://avelino.run/sponsors/do_logo_horizontal_blue-210.png" alt="Digital Ocean"></a>
@ -66,7 +77,7 @@
<ul>
{{range .Items}}
<li><a href="{{.Url}}" alt="Go to {{.Title}} link" title="Go to {{.Title}} link">{{.Description}}</a></li>
<li><a href="{{.Url}}?utm_campaign=awesomego&utm_medium=referral&utm_source=awesomego" alt="Go to {{.Title}} link" title="Go to {{.Title}} link">{{.Description}}</a></li>
{{end}}
</ul>