mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
parent
9150a98f3e
commit
1cbdd3e59d
1 changed files with 5 additions and 0 deletions
|
@ -135,6 +135,8 @@ func serve(port int) {
|
|||
}
|
||||
}
|
||||
|
||||
// fixUrl massages the BaseUrl into a form needed for serving
|
||||
// all pages correctly.
|
||||
func fixUrl(s string) (string, error) {
|
||||
useLocalhost := false
|
||||
if s == "" {
|
||||
|
@ -144,6 +146,9 @@ func fixUrl(s string) (string, error) {
|
|||
if !strings.HasPrefix(s, "http://") && !strings.HasPrefix(s, "https://") {
|
||||
s = "http://" + s
|
||||
}
|
||||
if !strings.HasSuffix(s, "/") {
|
||||
s = s + "/"
|
||||
}
|
||||
u, err := url.Parse(s)
|
||||
if err != nil {
|
||||
return "", err
|
||||
|
|
Loading…
Reference in a new issue