1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-19 12:35:31 -04:00

create inline-svg partial function

[skip ci]
This commit is contained in:
2020-05-14 13:36:27 -04:00
parent 59a92fc60e
commit 24edb85379
7 changed files with 7 additions and 22 deletions

View File

@@ -1,4 +1,4 @@
{{ $svg := resources.Get "img/logo.svg" -}}
{{ $svg := resources.Get .src -}}
{{ $html := $svg.Content -}}
{{/* remove unneeded tags/attributes when SVG is inlined versus a .svg file */}}
@@ -10,5 +10,6 @@
{{ $html = replace $html "<svg" $wxh -}}
{{/* bit of a hack: calling .Permalink so that the SVG file is published too */}}
{{ printf "<!-- auto-inlined from: %s -->" $svg.Permalink | safeHTML }}
{{ $html | safeHTML -}}

View File

@@ -1,7 +1,7 @@
<header>
<nav>
<a class="no-underline" href="{{ .Site.BaseURL }}" id="logo" rel="me author" aria-label="{{ .Site.Title }}">
{{ partial "svg/logo.svg" (dict "width" 28 "height" 40) }}
{{ partial "functions/inline-svg" (dict "src" "img/logo.svg" "width" 28 "height" 40) }}
<h1 id="name">{{ .Site.Title }}</h1>
</a>
<ul>