This commit is contained in:
xing 2023-12-24 00:20:35 +08:00
parent 0774b122ee
commit c38b62c82a

View File

@ -95,12 +95,13 @@ func (p CommentPageEle) Urls(u url.URL, page int, isTLS bool) string {
if !strings.Contains(path, "/comment-page-") { if !strings.Contains(path, "/comment-page-") {
path = fmt.Sprintf("%s%s", path, "/comment-page-1#comments") path = fmt.Sprintf("%s%s", path, "/comment-page-1#comments")
} }
path = commentReg.ReplaceAllString(path, fmt.Sprintf("/comment-page-%d#comments", page)) path = commentReg.ReplaceAllString(path, fmt.Sprintf("/comment-page-%d", page))
path = strings.Replace(path, "//", "/", -1) path = strings.Replace(path, "//", "/", -1)
if path == "" { ur := str.Join(path, query)
path = "/" if !strings.Contains(ur, "#comments") {
ur = str.Join(ur, "#comments")
} }
return str.Join(path, query) return ur
} }
func (p CommentPageEle) Middle(page int, url string) string { func (p CommentPageEle) Middle(page int, url string) string {