feat: automatically generate website icons

See #1439
This commit is contained in:
George Cushen committed 2019-12-28 23:48:40 +00:00
1 parent 6c86640af4
commit ce75013228
8 files changed
+15 -8

No files matched your search

File renamed without changes.
+2 -2
View File
@@ -6,11 +6,11 @@
"theme_color": "{{ $scr.Get "primary" }}",
"background_color": "{{ $scr.Get "primary" }}",
"icons": [{
"src": "../img/icon-192.png",
"src": "{{ (partial "functions/get_icon" 192).RelPermalink }}",
"sizes": "192x192",
"type": "image/png"
}, {
"src": "../img/icon-512.png",
"src": "{{ (partial "functions/get_icon" 512).RelPermalink }}",
"sizes": "512x512",
"type": "image/png"
}],
+7
View File
@@ -0,0 +1,7 @@
{{/* Function to get website icon image. */}}
{{/* Input: size (int) */}}
{{/* Output: resource (obj) */}}
{{ $icon := resources.GetMatch "images/icon.png" }}
{{ $icon_resized := $icon.Fill (printf "%sx%s Center" (string .) (string .)) }}
{{ return $icon_resized }}
+1 -1
View File
@@ -10,7 +10,7 @@
{{ $author := partial "functions/get_author_name" $page }}
{{ $publisher := site.Params.org_name | default site.Title }}
{{ $logo_url := printf "img/%s" (site.Params.logo | default "icon-512.png") | absURL }}
{{ $logo_url := (printf "img/%s" (site.Params.logo | absURL)) | default (partial "functions/get_icon" 512).Permalink }}
<script type="application/ld+json">
{
+3 -3
View File
@@ -142,8 +142,8 @@
{{ end }}
<link rel="manifest" href="{{ "index.webmanifest" | relLangURL }}">
<link rel="icon" type="image/png" href="{{ "img/icon-32.png" | relURL }}">
<link rel="apple-touch-icon" type="image/png" href="{{ "img/icon-192.png" | relURL }}">
<link rel="icon" type="image/png" href="{{(partial "functions/get_icon" 32).RelPermalink}}">
<link rel="apple-touch-icon" type="image/png" href="{{(partial "functions/get_icon" 192).RelPermalink}}">
<link rel="canonical" href="{{ .Permalink }}">
@@ -163,7 +163,7 @@
{{ $og_image = (printf "img/%s" site.Params.avatar) | absURL }}
{{ $twitter_card = "summary" }}
{{ else }}
{{ $og_image = "img/icon-192.png" | absURL }}
{{ $og_image = (partial "functions/get_icon" 512).Permalink }}
{{ $twitter_card = "summary" }}
{{ end }}
{{ $scr.Set "og_image" $og_image }}{{/* Set `og_image` globally for `rss.xml`. */}}
+2 -2
View File
@@ -10,8 +10,8 @@
<meta name="generator" content="Source Themes Academic {{ site.Data.academic.version }}">
<link rel="manifest" href="{{ "index.webmanifest" | relLangURL }}">
<link rel="icon" type="image/png" href="{{ "img/icon-32.png" | relURL }}">
<link rel="apple-touch-icon" type="image/png" href="{{ "img/icon-192.png" | relURL }}">
<link rel="icon" type="image/png" href="{{(partial "functions/get_icon" 32).RelPermalink}}">
<link rel="apple-touch-icon" type="image/png" href="{{(partial "functions/get_icon" 192).RelPermalink}}">
<link rel="canonical" href="{{ .Permalink }}">
Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB