Skip to content

Add configurable page title via dedicated Title option - #119

Open
nikicat wants to merge 2 commits into
swaggo:masterfrom
nikicat:master
Open

nikicat wants to merge 2 commits into
swaggo:masterfrom
nikicat:master

Conversation

@nikicat

@nikicat nikicat commented Mar 12, 2024

Copy link
Copy Markdown

Make the Swagger UI HTML page title configurable.

Adds a Title config field and a Title(...) functional option. It defaults to "Swagger UI", so the page title is unchanged unless explicitly set:

e.GET("/swagger/*", echoSwagger.EchoWrapHandler(echoSwagger.Title("My API")))

This replaces the earlier {{.InstanceName}} | Swagger UI approach. A dedicated field is cleaner (per @svachaj's review feedback) and avoids regressing the default title to swagger | Swagger UI for users who don't set an instance name.

Related to #115

@svachaj

svachaj commented Jun 20, 2024

Copy link
Copy Markdown

InstanceName doesn't always have to be the best option for the page title. How about creating a new property, PageTitle? I think it's cleaner.

nikicat added a commit to nikicat/echo-swagger that referenced this pull request Jun 5, 2026
Replace the hardcoded `<title>Swagger UI</title>` with a configurable
`Title` config field, settable through a new `Title(...)` option. Defaults
to "Swagger UI", preserving the existing page title when unset.

This supersedes the `{{.InstanceName}} | Swagger UI` approach: a dedicated
field is cleaner (per review feedback on swaggo#119) and avoids regressing the
default title to "swagger | Swagger UI" for users who don't set an
instance name.

Related to swaggo#115

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@nikicat nikicat changed the title Add .InstanceName to title Add configurable page title via dedicated Title option Jun 5, 2026
@nikicat

nikicat commented Jun 5, 2026

Copy link
Copy Markdown
Author

@svachaj good point — reworked accordingly. Instead of reusing InstanceName, this now adds a dedicated Title config field with a Title(...) option, defaulting to "Swagger UI" so the default page title is preserved. Thanks for the suggestion!

nikicat and others added 2 commits June 5, 2026 14:11
Replace the hardcoded `<title>Swagger UI</title>` with a configurable
`Title` config field, settable through a new `Title(...)` option. Defaults
to "Swagger UI", preserving the existing page title when unset.

This supersedes the `{{.InstanceName}} | Swagger UI` approach: a dedicated
field is cleaner (per review feedback on swaggo#119) and avoids regressing the
default title to "swagger | Swagger UI" for users who don't set an
instance name.

Related to swaggo#115

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants