PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, February 6, 2022

[FIXED] Symfony NelmioAPIDocBundle: Remove Logo Header?

 February 06, 2022     nelmioapidocbundle, php, symfony     No comments   

Issue

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



Answered By - Abdelhak ouaddi
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing