phpsymfonynelmioapidocbundle

Symfony NelmioAPIDocBundle: Remove Logo Header?


Is it possible to remove the logo header shown in the web-based output of NelmioApiDocBundle? And if so, how?

I would like to include the output of this endpoint (/api/doc if you're using the default settings) in an existing website. However, that site already has a header, and adding a second header would be a poor user experience IMHO. But I can't find any place in the documentation that describes how to exclude this gloriously 1990s-style piece of web design.

I've provided a screenshot of the default config below, which is what I get when viewing the docs in a tool like Insomnia. As you can see, the green header is covering the page as it scrolls.

Header Example


Solution

  • Yes, you can do it.

    You should override bundle template, say steps bellow :

    1 - Create template file in 'templates/bundles/NelmioApiDocBundle/SwaggerUi/index.html.twig'

    2 - Put the content bellow :

    {% extends '@!NelmioApiDoc/SwaggerUi/index.html.twig' %}
    
    {% block header %}
        <a style="text-decoration: none;" id="logo" href="#" target="_blank">
            <h1 style="color: black">You personal title</h1>
        </a>
    {% endblock %}
    

    That's it , we done