Torben Nielsen
Torben Nielsen

Reputation: 833

Is it possible to change HTML title with SwashBuckle and Swagger UI

We have many services, which use SwashBuckle / Swagger UI to expose REST methods.

It can often be annoying when you have several of them open in tabs in a browser that you cannot immdiately see the service name from the tabs. At least not without switching to that tab

Is it possible to change the HTML title from SwashBuckle?

enter image description here

Upvotes: 15

Views: 3583

Answers (2)

Nenad Zivkovic
Nenad Zivkovic

Reputation: 18559

For those using NestJs SwaggerModule, changing HTML title is done with property customSiteTitle in SwaggerCustomOptions, which is optional 4th parameter to SwaggerModule.setup

in your main.ts, if you have line like this:

SwaggerModule.setup('api', app, documentFactory);

change it to:

SwaggerModule.setup('api', app, documentFactory, {customSiteTitle:  "Your Title"} );

Upvotes: 0

MrMoeinM
MrMoeinM

Reputation: 2378

Yes, Simply change document title

app.UseSwaggerUI(option => 
{ 
    ...
    option.DocumentTitle = "Your Title"; 
    ...
});

Upvotes: 31

Related Questions