Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[awesome-go.com]: Table of Contents Links go to wrong page #4752

Closed
sonashannon opened this issue Feb 17, 2023 · 2 comments
Closed

[awesome-go.com]: Table of Contents Links go to wrong page #4752

sonashannon opened this issue Feb 17, 2023 · 2 comments

Comments

@sonashannon
Copy link

  1. Go to https://awesome-go.com/
  2. Click on "Bit-packing and Compression"

Result: Browser goes to a separate web page showing an out of date list.

Expected: Browser should scroll down to the Bit-packing and compression area in the same page.

Am I right? I can fix if needed. Why do we have these separate areas? Seems harder to maintain.

@avelino
Copy link
Owner

avelino commented Mar 18, 2023

the behavior should be: go to a category page, showing the updated (not outdated) list

awesome-go/make_site.go

Lines 112 to 133 in 6d38d78

func changeLinksInIndex(html string, query *goquery.Document, objs map[string]*Object) {
query.Find("body #content ul li ul li a").Each(func(_ int, s *goquery.Selection) {
href, hrefExists := s.Attr("href")
if !hrefExists {
return
}
// do not replace links if no page has been created for it
_, objExists := objs[href]
if !objExists {
return
}
uri := strings.SplitAfter(href, "#")
if len(uri) >= 2 && uri[1] != "contents" {
html = strings.ReplaceAll(
html, fmt.Sprintf(`href="%s"`, href), fmt.Sprintf(`href="%s"`, uri[1]))
}
})
os.WriteFile("./tmpl/index.html", []byte(html), 0644)
}

@avelino avelino added the bug label Mar 18, 2023
@Ashfaq97
Copy link

Ashfaq97 commented May 1, 2023

Hello @avelino

It looks like the issue has been solved. The link was pointing to the directed place. Could you close the case?

Thanks!

@avelino avelino closed this as completed May 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants