redoc icon indicating copy to clipboard operation
redoc copied to clipboard

How to get favicon to work with redoc-cli?

Open pcolmer opened this issue 5 years ago • 3 comments

I'm using redoc-cli to build the HTML file. This is being done under CI/CD, which then copies the file to AWS S3.

I've added a favicon.ico file to the root of the S3 bucket but I cannot find a mechanism with redoc-cli to get it to include the favicon details into the constructed HTML.

It would seem that it should be possible to do this via the theme option but I cannot see how that can be achieved.

pcolmer avatar Dec 23 '20 08:12 pcolmer

hey @pcolmer, I have come across this issue as well, and what I did was basically have my own template file which will include that icon.

Example:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf8" />
    <title>{{title}}</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="shortcut icon" type="image/png" href="favicon.ico"/>
    <style>
      body {
        padding: 0;
        margin: 0;
        background-color: "blue"
      }
    </style>
    {{{redocHead}}}
    {{#unless disableGoogleFont}}<link href="https://fonts.googleapis.com/css?family=Montserrat:300,400,700|Roboto:300,400,700" rel="stylesheet">{{/unless}}
  </head>
  <body>
    {{{redocHTML}}}
  </body>
</html>

after that, i would run redoc-cli bundle --options=options.json -t template.hbs openApi.json

kyapwc avatar Jan 11 '21 04:01 kyapwc

Brilliant! Thanks, @kyapwc

pcolmer avatar Jan 11 '21 08:01 pcolmer

Thanks, it worked for me

khaitranhq avatar Jun 15 '22 04:06 khaitranhq