Skip to content

Commit

Permalink
Merge pull request #618 from yshmarov/patch-1
Browse files Browse the repository at this point in the history
update readme section - Customizing the swagger-ui
  • Loading branch information
romanblanco authored Apr 3, 2023
2 parents 68aaeb6 + 9da6379 commit 5d77db9
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1043,7 +1043,26 @@ rails g rswag:ui:custom

```

This will add a local version that you can modify at _app/views/rswag/ui/home/index.html.erb_
This will add a local version that you can modify at _app/views/rswag/ui/home/index.html.erb_. For example, it will let you to add your own `<title>` and favicon.

To replace the *"Swagger sponsored by"* brand image, you can add the following script to the generated file:

```html
<script>
(function () {
window.addEventListener("load", function () {
setTimeout(function () {
var logo = document.getElementsByClassName('link');
logo[0].children[0].alt = "My API";
logo[0].children[0].src = "/favicon.png";
});
}); })();
</script>
```

The above script would expect to find an image named `favicon.png` in the public folder.

### Serve UI Assets Directly from your Web Server

Expand Down

0 comments on commit 5d77db9

Please sign in to comment.