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

Rendered site sets social image height to '{{ . }}' #454

Closed
tlindsay42 opened this issue Dec 12, 2021 · 2 comments
Closed

Rendered site sets social image height to '{{ . }}' #454

tlindsay42 opened this issue Dec 12, 2021 · 2 comments

Comments

@tlindsay42
Copy link
Contributor

Noticed the following warnings in my dev tools console for the GitHub, GitLab, and LinkedIn social icons, but not the Twitter icon: Unexpected value {{ . }} parsing height attribute.

image

@danielfdickinson
Copy link

I noticed this issue when validating my site as well (actually it was my link checker that complained because it didn't know how to interpret the style; go figure).

This issue is that most of the svgs are assets and not processed as templates and therefore the Go templates in the svg files stay verbatim.

For example, for LinkedIn at

<svg {{ with .size }} height="{{ . }}" {{ end }} style="enable-background:new 0 0 65 65;" version="1.1" viewBox="0 0 65 65" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
:

<svg {{ with .size }} height="{{ . }}" {{ end }} style="enable-background:new 0 0 65 65;" version="1.1" viewBox="0 0 65 65"  xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">

Notice the {{ with .size }}…

Also on the next line:

  <path d="M50.837,48.137V36.425c0-6.275-3.35-9.195-7.816-9.195  c-3.604,0-5.219,1.983-6.119,3.374V27.71h-6.79c0.09,1.917,0,20.427,0,20.427h6.79V36.729c0-0.609,0.044-1.219,0.224-1.655  c0.49-1.22,1.607-2.483,3.482-2.483c2.458,0,3.44,1.873,3.44,4.618v10.929H50.837z M22.959,24.922c2.367,0,3.842-1.57,3.842-3.531  c-0.044-2.003-1.475-3.528-3.797-3.528s-3.841,1.524-3.841,3.528c0,1.961,1.474,3.531,3.753,3.531H22.959z M34,64  C17.432,64,4,50.568,4,34C4,17.431,17.432,4,34,4s30,13.431,30,30C64,50.568,50.568,64,34,64z M26.354,48.137V27.71h-6.789v20.427  H26.354z" style="fill-rule:evenodd;clip-rule:evenodd;fill:{{ .fill }};"/>

Notice the fill:{{ .fill }};

Even where the svg is a partial, some issues remain. For example:

<path d="M598 128h298v298h-86v-152l-418 418-60-60 418-418h-152v-86zM810 810v-298h86v298c0 46-40 86-86 86h-596c-48 0-86-40-86-86v-596c0-46 38-86 86-86h298v86h-298v596h596z" style="fill-rule:evenodd;clip-rule:evenodd;fill:{{ .fill }};"/>

would work if .fill were provided but in

<span class="new-window">{{ partial "svg/new-window.svg" (dict "size" $new_window_icon_size) }}</span>

<span class="new-window">{{ partial "svg/new-window.svg" (dict "size" $new_window_icon_size) }}</span>

we see it is not.

I'm guessing this is an @regisphilibert task.

@regisphilibert
Copy link
Member

I think this has been fixed #461

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

3 participants