Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SVG logos without width/height not displayed in masthead #3845

Open
silvio2402 opened this issue Aug 9, 2022 · 1 comment
Open

SVG logos without width/height not displayed in masthead #3845

silvio2402 opened this issue Aug 9, 2022 · 1 comment

Comments

@silvio2402
Copy link

silvio2402 commented Aug 9, 2022

What happened?

  • Minimal Mistakes version: latest

Since this is a general issue with the theme, I won't be providing information such as operating system. Other details will be provided on request if needed.

The Problem

SVG images don't have to contain explicit width and height attributes. This makes the logo render at the size of 0 width and 0 height.

Expected behavior

My expectations are that the logo image's size in the masthead is displayed with an appropriate width and height.

Steps to reproduce the behavior

  1. Move an SVG file without width and height attributes to e.g. /assets/images/logo.svg. Heres an example of such an SVG:
<svg viewBox="0 0 500 180" xmlns="http://www.w3.org/2000/svg">
  <polyline points="0,40 40,40 40,80 80,80 80,120 120,120 120,160" style="fill:white;stroke:red;stroke-width:4" />
  Sorry, your browser does not support inline SVG.
</svg>

Source

  1. Set the logo to the path of your SVG, e.g. logo: "/assets/images/logo.svg", in your _config.yml.
  2. Start jekyll live server to test it.
  3. Observe, or rather, not observe the logo in the masthead.

If width and/or height attributes are given to the SVG, it displays correctly.

Possible Fixes

Here's what I think could fix this issue:

  • The "it's a feature, not a bug" way: Make the user put the width and/or height attributes in the SVG.
  • Giving the image a min-height style.
  • Add a variable to the config for manually setting the logo width and/or height.

Let me know what you think is the best solution.
Best regards,
Silvio

@silvio2402
Copy link
Author

silvio2402 commented Aug 9, 2022

I have noticed that this issue only occurs when masthead_title: " " is in the config and have edited the issue.

Edit: I have been getting mixed results with wheter it works with or without the masthead title. Please somebody try it out too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant