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

swap native emojis for Twemojis 🎉 (#92)

This commit is contained in:
2020-03-29 15:30:12 -04:00
committed by GitHub
parent 3dd0f9578e
commit 2156c6ed88
17 changed files with 73 additions and 40 deletions

View File

@@ -10,6 +10,7 @@
{{ block "main" . }}{{ end }}
</div>
{{ partialCached "page/footer" . }}
{{ partial "scripts/twemoji" . }}
{{ partial "scripts/shortcodes" . }}
{{ if eq hugo.Environment "production" }}
{{ partialCached "scripts/simple_analytics" . }}

View File

@@ -10,6 +10,10 @@
/fonts/*
Cache-Control: max-age=31536000, public, immutable, no-transform
# Super long cache for Twemojis (one year)
/twemoji/*
Cache-Control: max-age=31536000, public, immutable, no-transform
# Recommended MIME type for PWA manifests
# https://github.com/w3c/manifest/issues/689
/manifest.json

View File

@@ -6,7 +6,7 @@
</a>
<ul>
{{- range .Site.Menus.main }}
<li><a class="no-underline" {{ printf "href=%q" .URL | safeHTMLAttr }} aria-label="{{ .Name }}"{{ if strings.HasPrefix .URL "http" }} target="_blank" rel="me noopener"{{ end }}><span class="emoji">{{ .Pre }}</span><span class="text">{{ .Name }}</span></a></li>
<li><a class="no-underline" {{ printf "href=%q" .URL | safeHTMLAttr }} aria-label="{{ .Name }}"{{ if strings.HasPrefix .URL "http" }} target="_blank" rel="me noopener"{{ end }}><span class="icon">{{ .Pre }}</span><span class="text">{{ .Name }}</span></a></li>
{{ end -}}
</ul>
</nav>

View File

@@ -0,0 +1,2 @@
<script src="{{ "/twemoji/twemoji.min.js" | absURL }}"></script>
<script>twemoji.parse(document.body,{base:'{{ "/" | absURL }}',folder:'twemoji/svg',ext:'.svg'})</script>

View File

@@ -9,6 +9,6 @@
<figcaption>{{ . | $.Page.RenderString | safeHTML }}</figcaption>
</figure>
{{- else -}}
<p><img src="{{ $optimized.Permalink }}" width="{{ $optimized.Width }}" height="{{ $optimized.Height }}"
{{- with .Get "alt" }} alt="{{ . | safeHTML }}" title="{{ . | safeHTML }}"{{ end }}></p>
<p class="image"><img src="{{ $optimized.Permalink }}" width="{{ $optimized.Width }}" height="{{ $optimized.Height }}"
{{- with .Get "alt" }} alt="{{ . | safeHTML }}" title="{{ . | safeHTML }}"{{ end }}></p>
{{- end }}