cmd/frontend: add -local flag to run frontend in LocalMode

The frontend UI show/hide elements and links based on whether the frontend server is running in `LocalMode`. For the `frontend` this value is hardcoded to `false`.

This PR adds the flag `-local` to allow starting the frontend in `LocalMode`. This is particularly beneficial for those who wish to run the `frontend` locally or self-host for internal packages.

Fixes golang/go#60872

Change-Id: I355419bfef65bdbd970d7e602775d44ee8755c10
GitHub-Last-Rev: 4a8140a24336daf711e0c6500d070d27ab101198
GitHub-Pull-Request: golang/pkgsite#66
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/504336
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Peter Weinberger <pjw@google.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
diff --git a/cmd/frontend/main.go b/cmd/frontend/main.go
index e84d1c3..c3b46d3 100644
--- a/cmd/frontend/main.go
+++ b/cmd/frontend/main.go
@@ -37,6 +37,7 @@
 	staticFlag     = flag.String("static", "static", "path to folder containing static files served")
 	thirdPartyPath = flag.String("third_party", "third_party", "path to folder containing third-party libraries")
 	devMode        = flag.Bool("dev", false, "enable developer mode (reload templates on each page load, serve non-minified JS/CSS, etc.)")
+	localMode      = flag.Bool("local", false, "enable local mode (hide irrelevant content and links to go.dev)")
 	disableCSP     = flag.Bool("nocsp", false, "disable Content Security Policy")
 	proxyURL       = flag.String("proxy_url", "https://proxy.golang.org", "Uses the module proxy referred to by this URL "+
 		"for direct proxy mode and frontend fetches")
@@ -120,6 +121,7 @@
 		StaticPath:           *staticFlag,
 		ThirdPartyFS:         os.DirFS(*thirdPartyPath),
 		DevMode:              *devMode,
+		LocalMode:            *localMode,
 		ReportingClient:      rc,
 		VulndbClient:         vc,
 	})