28 lines
615 B
Go
28 lines
615 B
Go
package slowtwitch
|
|
|
|
import "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 + "_" + string(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, ")", "_")
|
|
|
|
return output
|
|
}
|