package slowtwitch import ( "strconv" "strings" ) func ConvertUrlToCategoryFormat(oldUrl string) string { output := convert(oldUrl) return "/" + output + "/index.html" } func ConvertPostTitleToPath(title string, id int) string { output := convert(title) return output + "_" + strconv.Itoa(id) + ".html" } func GetURL(path string) string { return "https://www.slowtwitch.com" + path } func convert(path string) string { output := strings.ReplaceAll(path, " ", "_") output = strings.ReplaceAll(output, "$", "_") output = strings.ReplaceAll(output, "(", "_") output = strings.ReplaceAll(output, ")", "_") output = strings.ReplaceAll(output, "?", "") output = strings.ReplaceAll(output, ",", "") output = strings.ReplaceAll(output, "%", "%25") output = strings.ReplaceAll(output, "_&", "") output = strings.ReplaceAll(output, "&", "") output = strings.ReplaceAll(output, "#", "") output = strings.ReplaceAll(output, ";", "") return output }