go.dev/cmd/internal/site: fix tests on Windows
The site will never run on Windows, but keeping the tests passing
makes the x/website TryBots happy, and it is easy to do.
Fixes golang/go#46501.
Change-Id: Ib9ea07dc4164fbea38b7624c32a6f46d7bab6739
Reviewed-on: https://go-review.googlesource.com/c/website/+/324510
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Website-Publish: Russ Cox <rsc@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
diff --git a/go.dev/cmd/internal/site/page.go b/go.dev/cmd/internal/site/page.go
index ed080be..02c9f97 100644
--- a/go.dev/cmd/internal/site/page.go
+++ b/go.dev/cmd/internal/site/page.go
@@ -9,6 +9,7 @@
"fmt"
"io/ioutil"
"path"
+ "path/filepath"
"strings"
"time"
@@ -32,6 +33,7 @@
// loadPage loads the site's page from the given file.
// It returns the page but also adds the page to site.pages and site.pagesByID.
func (site *Site) loadPage(file string) (*page, error) {
+ file = filepath.ToSlash(file)
id := strings.TrimPrefix(file, "_content/")
if id == "index.md" {
id = ""