[BUG]: Logo is always trying to load `.icons/<path>.svg`
See original GitHub issue- I’ve read the [contribution guidelines][1] and agree with them
I’ve found a bug and checked that …
- … the problem doesn’t occur with the default MkDocs template
- … the problem is not in any of my customizations (CSS, JS, template)
- … the documentation does not mention anything about my problem
- … there are no open or closed issues that are related to my problem
Description
I’m having trouble getting the logo feature to work.
I have no problem with the favicon
which uses a path in the same directory. I’ve tried both SVG and PNG but neither work.
I’ve tried providing the path without the SVG extension and placing it in a .icons/
dir outside of docs_dir
relative to mkdocs.yml
, within docs_dir
and within theme.custom_dir
, only theme.custom_dir='theme'
with theme/.icon/dm-logo.svg
and icon.logo: dm-logo
(without the .svg
extension) resulted in a successful build.
If I prepend the .icons/
path prefix to test the other two .icons/
folders I get failure with .icons/.icons/dm-logo.svg
output in the console. This doesn’t improve by removing the dot from the directory names to become icons/
, nor with .png
extension, which outputs .icons/icons/dm-logo.png.svg
Further more the SVG itself with the successful case was not visible, it was loaded but not scaled, instead the CSS applied just resulted in a clipped top-left section of the SVG viewbox, which made it look like it was empty. Inspecting the DOM shows the SVG was loaded, just clipped out of view. Additionally the fill: currentColor
CSS flattened out some SVG details.
Expected behavior
Supply a logo graphic to use and it should work.
Actual behavior
A: Fails to run mkdocs serve
, seems to try load an internal graphic instead.
B: Loads .icons/dm-logo.svg
if in the custom_dir
.icons/
subdirectory and no extension is provided. SVG is not scaled, thus is clipped from view. Docs don’t provide expected size constraints for SVG logo.
Steps to reproduce the bug
- Add an image for logo.
- Update config in
mkdocs.yml
to use that image resource. - Try
mkdocs serve
(I’m just running the container), process exits with no error but prints out.icons/assets/dm-logo.png.svg
Package versions
Current Docker image release (7.x)
Project configuration
docs_dir: 'content/'
theme:
name: 'material'
favicon: assets/favicon.ico # Works fine
icon:
logo: assets/dm-logo.png # Breaks serve, despite valid location in `content/assets/`
repo: fontawesome/brands/github
features:
- navigation.tabs
- navigation.expand
markdown_extensions:
- toc:
permalink: ⚓︎
- abbr
- attr_list
- admonition
- pymdownx.details
- pymdownx.highlight
- pymdownx.superfences
- pymdownx.magiclink
- pymdownx.emoji:
emoji_index: !!python/name:materialx.emoji.twemoji
emoji_generator: !!python/name:materialx.emoji.to_svg
System information
Manjaro Linux with Firefox. Present with Docker container build.
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (9 by maintainers)
Top GitHub Comments
Sadly, no. We can’t issue error messages from Jinja templates. Believe me, we would’ve done it when it was possible.
Other than that, I’m sorry but I have to say that I find your reactions to my comments not very professional and rather hostile (downvoting + allegations). I would kindly ask you to respect my time and have to remind you to follow the code of conduct, which you didn’t.
The SVG issue may be due to the width/height properties or viewBox not being set correctly. It’s nothing that is on our side.