mkdocsmkdocs-material

Removing credits from mkdocs material


In mkdocs with material theme, how I can remove credits at the bottom.

Made with Material for MkDocs

enter image description here Is there any settings in mkdocs.yml for this?

Gone through documentation(https://squidfunk.github.io/mkdocs-material/setup/changing-the-colors/), couldn't find any direct way.


Solution

  • There is no direct way to do this. Workaround is to have below in mkdocs.yml

    ...
    nav:
      - Home:
        - Room under home: index.md
        - Another room under home: home.md
      - About: about.md
    extra_javascript:
        - 'javascripts/removeCredits.js'
    ...
    

    Create a file docs/javascripts/removeCredits.js as below:

    document.addEventListener("DOMContentLoaded", function() {
        removeCredits();
    });
    
    function removeCredits(){
        document.querySelectorAll('.md-copyright')[0].getElementsByTagName("a")[0].remove();
        document.querySelectorAll('.md-copyright')[0].childNodes[1].remove();
    }
    

    **Change the indices of DOM elements as per your situation. If you are using another copyright from mkdocs.yml file, then DOM will change.