diff --git a/fly.toml b/fly.toml
index 3249f833..1b3070eb 100644
--- a/fly.toml
+++ b/fly.toml
@@ -16,6 +16,7 @@ strategy = "immediate"
[env]
ROOT_URL = "https://scribblers.bios-marcel.link"
+ALLOW_INDEXING = true
SERVE_DIRECTORIES = ":/public"
LOBBY_SETTING_BOUNDS_MAX_MAX_PLAYERS = 100
diff --git a/internal/config/config.go b/internal/config/config.go
index 0dfc4c65..60ea35ca 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -57,6 +57,9 @@ type Config struct {
// CanonicalURL specifies the original domain, in case we are accessing the
// site via some other domain, such as scribblers.fly.dev
CanonicalURL string `env:"CANONICAL_URL"`
+ // AllowIndexing will control whether the noindex, nofollow meta tag is
+ // added to the home page.
+ AllowIndexing bool `env:"ALLOW_INDEXING"`
// ServeDirectories is a map of `path` to `directory`. All directories are
// served under the given path.
ServeDirectories map[string]string `env:"SERVE_DIRECTORIES"`
diff --git a/internal/frontend/http.go b/internal/frontend/http.go
index cf26874d..0888c7c3 100644
--- a/internal/frontend/http.go
+++ b/internal/frontend/http.go
@@ -54,6 +54,9 @@ type BasePageConfig struct {
// CanonicalURL specifies the original domain, in case we are accessing the
// site via some other domain, such as scribblers.fly.dev
CanonicalURL string `json:"canonicalUrl"`
+ // AllowIndexing will control whether the noindex, nofollow meta tag is
+ // added to the home page.
+ AllowIndexing bool `env:"ALLOW_INDEXING"`
}
var fallbackChecksum = uuid.Must(uuid.NewV4()).String()
diff --git a/internal/frontend/index.go b/internal/frontend/index.go
index 52281fe2..77509931 100644
--- a/internal/frontend/index.go
+++ b/internal/frontend/index.go
@@ -45,12 +45,13 @@ type SSRHandler struct {
func NewHandler(cfg *config.Config) (*SSRHandler, error) {
basePageConfig := &BasePageConfig{
- checksums: make(map[string]string),
- hash: md5.New(),
- Version: version.Version,
- Commit: version.Commit,
- RootURL: cfg.RootURL,
- CanonicalURL: cfg.CanonicalURL,
+ checksums: make(map[string]string),
+ hash: md5.New(),
+ Version: version.Version,
+ Commit: version.Commit,
+ RootURL: cfg.RootURL,
+ CanonicalURL: cfg.CanonicalURL,
+ AllowIndexing: cfg.AllowIndexing,
}
if cfg.RootPath != "" {
basePageConfig.RootPath = "/" + cfg.RootPath
diff --git a/internal/frontend/templates/index.html b/internal/frontend/templates/index.html
index 1991dece..42ccd313 100644
--- a/internal/frontend/templates/index.html
+++ b/internal/frontend/templates/index.html
@@ -12,6 +12,8 @@
skribbl.io, scribble, scribblers, scribble.rs, pictionary,
montagsmaler, sketchful, draw and guess, drawmything, free, oss">
+ {{if not .AllowIndexing}}
+ {{end}}
{{if ne "" .RootURL}}