From 662dd80fc56198deb6d1f4628539566de68af558 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=BB=91?= <1395348685z@gmail.com>
Date: Mon, 5 Apr 2021 17:16:49 +0800
Subject: [PATCH] Minor fixes on #226 (#240)
* Fix head inject point
* Switch `.link-grid-image` to ` `
* Switch `.link-grid-image` back to ``
- Set `type` to `image/jpeg` for image without file extension
---
layout/_layout.njk | 3 ++-
layout/_partials/head/head-unique.njk | 2 --
scripts/tags/link-grid.js | 4 +++-
3 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/layout/_layout.njk b/layout/_layout.njk
index 82b01bb..8334c5a 100644
--- a/layout/_layout.njk
+++ b/layout/_layout.njk
@@ -3,8 +3,9 @@
{{ partial('_partials/head/head.njk', {}, {cache: theme.cache.enable}) }}
{%- include '_partials/head/head-unique.njk' -%}
- {{- next_js('load-config.js', true) }}
{% block title %}{% endblock %}
+ {{- next_js('load-config.js', true) }}
+ {{- next_inject('head') }}
{{ partial('_third-party/analytics/index.njk', {}, {cache: theme.cache.enable}) }}
diff --git a/layout/_partials/head/head-unique.njk b/layout/_partials/head/head-unique.njk
index 12981e7..d06e849 100644
--- a/layout/_partials/head/head-unique.njk
+++ b/layout/_partials/head/head-unique.njk
@@ -21,5 +21,3 @@
theme.calendar | safedump | escape
if page.type === 'schedule' and not page.title
}}">
-
-{{- next_inject('head') }}
diff --git a/scripts/tags/link-grid.js b/scripts/tags/link-grid.js
index 1dfb800..22913cb 100644
--- a/scripts/tags/link-grid.js
+++ b/scripts/tags/link-grid.js
@@ -8,8 +8,10 @@ module.exports = function([image = '/images/avatar.gif', delimiter = '|', commen
const links = content.split('\n').filter(line => line.trim() !== '').map(line => {
const item = line.split(delimiter).map(arg => arg.trim());
if (item[0][0] === comment) return '';
+ const imageSource = item[3] || image;
+ const hasExtension = /\.[^/]+$/.test(imageSource);
return `
-
+
${item[0]}
${item[2] || item[1]}
`;