From 5bbbb790248c8932ae89e8241f7e7a966d737ef9 Mon Sep 17 00:00:00 2001 From: Sarah Date: Sun, 5 Apr 2026 17:33:37 -0700 Subject: [PATCH] Centralize MUD branding configuration for easier customization Add Tagline, Description, URL, DiscordURL, AdminName, and AdminEmail fields to the Server config section so operators can rebrand entirely from config.yaml without editing templates or recompiling. Templates now use {{ branding "Field" }} calls instead of hardcoded strings for the MUD name, tagline, project URL, and Discord link. Closes #84 Co-Authored-By: Claude Opus 4.6 (1M context) --- _datafiles/config.yaml | 18 +++++++++++++ .../default/templates/help/about.template | 10 ++++---- .../templates/login/connect-splash.template | 4 +-- .../world/empty/templates/help/about.template | 10 ++++---- .../templates/login/connect-splash.template | 4 +-- internal/configs/config.server.go | 25 +++++++++++++++++++ internal/templates/templatesfunctions.go | 21 ++++++++++++++++ 7 files changed, 78 insertions(+), 14 deletions(-) diff --git a/_datafiles/config.yaml b/_datafiles/config.yaml index d42ea9174..17b612c9b 100755 --- a/_datafiles/config.yaml +++ b/_datafiles/config.yaml @@ -34,6 +34,24 @@ Server: # Display name of the MUD. # This will be used a few places by default (such as the web pages). MudName: "GoMud" + # - Tagline - + # Short tagline displayed on the login splash screen. + Tagline: "an open source MUD Library written in Go" + # - Description - + # Longer description used on the about page. + Description: "GoMud is an open source MUD (Multi-user Dungeon) game world and library." + # - URL - + # Project or server URL shown to players. + URL: "github.com/GoMudEngine/GoMud" + # - DiscordURL - + # Community Discord invite link. + DiscordURL: "discord.gg/cjukKvQWyy" + # - AdminName - + # Server operator name (optional, shown on about page if set). + AdminName: "" + # - AdminEmail - + # Contact email (optional, shown on about page if set). + AdminEmail: "" # - Seed - # The seed used for certain types of content generation # To prevent certain secrets or content from being spoiled, you can set this diff --git a/_datafiles/world/default/templates/help/about.template b/_datafiles/world/default/templates/help/about.template index 7d0ed527b..25bed9241 100644 --- a/_datafiles/world/default/templates/help/about.template +++ b/_datafiles/world/default/templates/help/about.template @@ -1,12 +1,12 @@ -.: About GoMud +.: About {{ branding "MudName" }} -GoMud is an open source MUD (Multi-user Dungeon) game world and library. +{{ branding "Description" }} -The GoMud engine ships with a default world to play in, but can be overwritten +The {{ branding "MudName" }} engine ships with a default world to play in, but can be overwritten or modified to build your own world using built-in tools. -Join the GoMud Discord Server: discord.gg/cjukKvQWyy -Find out more (or get the code): github.com/GoMudEngine/GoMud +Join the {{ branding "MudName" }} Discord Server: {{ branding "DiscordURL" }} +Find out more (or get the code): {{ branding "URL" }} .--. .-'. .--. .--. .--. .--. .`-. .--. :::::.\::::::::.\::::::::.\::::::::.\::::::::.\::::::::.\::::::::.\::::::::.\ diff --git a/_datafiles/world/default/templates/login/connect-splash.template b/_datafiles/world/default/templates/login/connect-splash.template index 6997be05f..c349d5fa1 100644 --- a/_datafiles/world/default/templates/login/connect-splash.template +++ b/_datafiles/world/default/templates/login/connect-splash.template @@ -18,9 +18,9 @@ -===============|xxx(} O -.: Welcome to GoMud, an open source MUD Library written in Go. +.: Welcome to {{ branding "MudName" }}, {{ branding "Tagline" }}. Find out more (or get the code) at: - github.com/GoMudEngine/GoMud + {{ branding "URL" }} {{ repeat "=" 80 }} diff --git a/_datafiles/world/empty/templates/help/about.template b/_datafiles/world/empty/templates/help/about.template index 7d0ed527b..25bed9241 100644 --- a/_datafiles/world/empty/templates/help/about.template +++ b/_datafiles/world/empty/templates/help/about.template @@ -1,12 +1,12 @@ -.: About GoMud +.: About {{ branding "MudName" }} -GoMud is an open source MUD (Multi-user Dungeon) game world and library. +{{ branding "Description" }} -The GoMud engine ships with a default world to play in, but can be overwritten +The {{ branding "MudName" }} engine ships with a default world to play in, but can be overwritten or modified to build your own world using built-in tools. -Join the GoMud Discord Server: discord.gg/cjukKvQWyy -Find out more (or get the code): github.com/GoMudEngine/GoMud +Join the {{ branding "MudName" }} Discord Server: {{ branding "DiscordURL" }} +Find out more (or get the code): {{ branding "URL" }} .--. .-'. .--. .--. .--. .--. .`-. .--. :::::.\::::::::.\::::::::.\::::::::.\::::::::.\::::::::.\::::::::.\::::::::.\ diff --git a/_datafiles/world/empty/templates/login/connect-splash.template b/_datafiles/world/empty/templates/login/connect-splash.template index 6997be05f..c349d5fa1 100644 --- a/_datafiles/world/empty/templates/login/connect-splash.template +++ b/_datafiles/world/empty/templates/login/connect-splash.template @@ -18,9 +18,9 @@ -===============|xxx(} O -.: Welcome to GoMud, an open source MUD Library written in Go. +.: Welcome to {{ branding "MudName" }}, {{ branding "Tagline" }}. Find out more (or get the code) at: - github.com/GoMudEngine/GoMud + {{ branding "URL" }} {{ repeat "=" 80 }} diff --git a/internal/configs/config.server.go b/internal/configs/config.server.go index 723dc1efa..ccd0537f8 100644 --- a/internal/configs/config.server.go +++ b/internal/configs/config.server.go @@ -2,6 +2,12 @@ package configs type Server struct { MudName ConfigString `yaml:"MudName"` // Name of the MUD + Tagline ConfigString `yaml:"Tagline"` // Short tagline shown on login splash + Description ConfigString `yaml:"Description"` // Longer description for about page + URL ConfigString `yaml:"URL"` // Project or server URL + DiscordURL ConfigString `yaml:"DiscordURL"` // Community Discord invite link + AdminName ConfigString `yaml:"AdminName"` // Server operator name (optional) + AdminEmail ConfigString `yaml:"AdminEmail"` // Contact email (optional) CurrentVersion ConfigString `yaml:"CurrentVersion"` // Current version this mud has been updated to Seed ConfigSecret `yaml:"Seed"` // Seed that may be used for generating content MaxCPUCores ConfigInt `yaml:"MaxCPUCores"` // How many cores to allow for multi-core operations @@ -19,6 +25,25 @@ func (s *Server) Validate() { // Ignore NextRoomId // Ignore Locked + if s.Tagline == `` { + s.Tagline = `an open source MUD Library written in Go` + } + + if s.Description == `` { + s.Description = `GoMud is an open source MUD (Multi-user Dungeon) game world and library.` + } + + if s.URL == `` { + s.URL = `github.com/GoMudEngine/GoMud` + } + + if s.DiscordURL == `` { + s.DiscordURL = `discord.gg/cjukKvQWyy` + } + + // Ignore AdminName + // Ignore AdminEmail + if s.Seed == `` { s.Seed = `Mud` // default } diff --git a/internal/templates/templatesfunctions.go b/internal/templates/templatesfunctions.go index 0a4fe1f4d..a52496d1e 100644 --- a/internal/templates/templatesfunctions.go +++ b/internal/templates/templatesfunctions.go @@ -207,6 +207,27 @@ var ( }, "map": makeMap, "t": language.T, + "branding": func(field string) string { + s := configs.GetServerConfig() + switch field { + case "MudName": + return string(s.MudName) + case "Tagline": + return string(s.Tagline) + case "Description": + return string(s.Description) + case "URL": + return string(s.URL) + case "DiscordURL": + return string(s.DiscordURL) + case "AdminName": + return string(s.AdminName) + case "AdminEmail": + return string(s.AdminEmail) + default: + return "" + } + }, } )