mirror of https://gitlab.com/curben/blog
fix(head): meta generator tag should be after <title>
- so that browser can parse <title> asap
This commit is contained in:
parent
2207579d19
commit
710b9b25a1
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
hexo.extend.tag.register('cloudinary', (args) => {
|
hexo.extend.tag.register('cloudinary', (args) => {
|
||||||
const user = 'curben'
|
const user = 'curben'
|
||||||
let fileName = args[0]
|
const fileName = args[0]
|
||||||
const alt = args[1] || ''
|
const alt = args[1] || ''
|
||||||
let modern = ''
|
let modern = ''
|
||||||
let legacy = ''
|
let legacy = ''
|
||||||
|
@ -26,37 +26,36 @@ hexo.extend.tag.register('cloudinary', (args) => {
|
||||||
legacy = fileName
|
legacy = fileName
|
||||||
}
|
}
|
||||||
|
|
||||||
fileName += '?auto_format=false'
|
const modernLink = link + '/' + modern + '?auto_format=false'
|
||||||
modern += '?auto_format=false'
|
const legacyLink = link + '/' + legacy + '?auto_format=false'
|
||||||
legacy += '?auto_format=false'
|
|
||||||
|
|
||||||
const img = `<img
|
const img = `<img
|
||||||
srcset="${link}/${legacy}&w=320 320w,
|
srcset="${legacyLink}&w=320 320w,
|
||||||
${link}/${legacy}&w=468 468w,
|
${legacyLink}&w=468 468w,
|
||||||
${link}/${legacy}&w=768 768w,
|
${legacyLink}&w=768 768w,
|
||||||
${link}/${legacy} 800w"
|
${legacyLink} 800w"
|
||||||
sizes="(max-width: 320px) 320px,
|
sizes="(max-width: 320px) 320px,
|
||||||
(max-width: 468px) 468px,
|
(max-width: 468px) 468px,
|
||||||
(max-width: 768px) 768px,
|
(max-width: 768px) 768px,
|
||||||
800px"
|
800px"
|
||||||
src="${link}/${legacy}"
|
src="${legacyLink}"
|
||||||
alt="${alt}" loading="lazy">`
|
alt="${alt}" loading="lazy">`
|
||||||
|
|
||||||
if (fileName.endsWith('.png') || fileName.endsWith('.webp')) {
|
if (fileName.endsWith('.png') || fileName.endsWith('.webp')) {
|
||||||
return `<a href="${link}/${fileName}">
|
return `<a href="${legacyLink}">
|
||||||
<picture><noscript>
|
<picture>
|
||||||
<source type="image/webp"
|
<source type="image/webp"
|
||||||
srcset="${link}/${modern}&w=320 320w,
|
srcset="${modernLink}&w=320 320w,
|
||||||
${link}/${modern}&w=468 468w,
|
${modernLink}&w=468 468w,
|
||||||
${link}/${modern}&w=768 768w,
|
${modernLink}&w=768 768w,
|
||||||
${link}/${modern} 800w"
|
${modernLink} 800w"
|
||||||
sizes="(max-width: 320px) 320px,
|
sizes="(max-width: 320px) 320px,
|
||||||
(max-width: 468px) 468px,
|
(max-width: 468px) 468px,
|
||||||
(max-width: 768px) 768px,
|
(max-width: 768px) 768px,
|
||||||
800px">
|
800px">
|
||||||
${img}
|
${img}
|
||||||
</noscript></picture></a>`
|
</picture></a>`
|
||||||
} else {
|
} else {
|
||||||
return `<a href="${link}/${fileName}"><noscript>${img}</noscript></a>`
|
return `<a href="${legacyLink}">${img}</a>`
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<%- metaGenerator() %>
|
|
||||||
<%
|
<%
|
||||||
let title = page.title
|
let title = page.title
|
||||||
|
|
||||||
|
@ -23,6 +22,7 @@
|
||||||
%>
|
%>
|
||||||
<title><% if (title) { %><%= title %> | <% } %><%= config.title %></title>
|
<title><% if (title) { %><%= title %> | <% } %><%= config.title %></title>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||||
|
<%- metaGenerator() %>
|
||||||
<%/* Add Open Graph meta tags for easier sharing on social networking sites */%>
|
<%/* Add Open Graph meta tags for easier sharing on social networking sites */%>
|
||||||
<%/* Modified from original source for compatibility with my blog */%>
|
<%/* Modified from original source for compatibility with my blog */%>
|
||||||
<%- openGraph() %>
|
<%- openGraph() %>
|
||||||
|
|
Loading…
Reference in New Issue