question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[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

  1. Add an image for logo.
  2. Update config in mkdocs.yml to use that image resource.
  3. 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:closed
  • Created 3 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
squidfunkcommented, Mar 1, 2021

Is it possible to address the console behaviour I received to instead print a friendly error/suggestion?

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.

1reaction
squidfunkcommented, Mar 1, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Random SVG icons won't load - Stack Overflow
I've had to debug this before, the missing icons would always load after a reload. It lead me to find that, if the...
Read more >
Here's How I Solved a Weird Bug Using Tried and True ...
It might happen randomly on load. It might even happen when the screen is resized. Whatever the situation, it happens! Ugh, why is...
Read more >
29683 - Extension icons should support SVG - chromium
1. Add an SVG file as an icon to a Chrome extension 2. Load the extension (unpacked) 3. Navigate to chrome://extensions/ What is...
Read more >
How to work with SVG icons - Florens Verschelde
Create a new document or new artboard in your favorite tool, and copy-paste your icon in the center. It's a great way to...
Read more >
How to use SVG Icons as React Components - Robin Wieruch
Next, put all your .svg icon files into a /assets folder next to your src/ folder. We don't want to have the assets...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found