blog/themes/fluid/layout/_partials/head.ejs
2024-11-16 11:34:10 +08:00

50 lines
2.0 KiB
Plaintext

<%
var separator = theme.title_join_string || theme.tab_title_separator
var title = page.title ? [page.title, config.title].join(separator) : config.title
var keywords = page.keywords || config.keywords
if (keywords instanceof Array) {
keywords = keywords.join(',')
}
var description = page.description || page.excerpt || (is_post() && page.content) || config.description
if (description) {
description = strip_html(description).substring(0, 200).trim().replace(/\n/g, ' ')
}
var ogImage = page.og_img || page.index_img
var ogConfig = Object.assign({ image: ogImage && url_for(ogImage) }, theme.open_graph)
%>
<head>
<meta charset="UTF-8">
<link rel="apple-touch-icon" sizes="76x76" href="<%= url_for(theme.apple_touch_icon) %>">
<link rel="icon" href="<%= url_for(theme.favicon) %>">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0, shrink-to-fit=no">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<% if (theme.force_https) { %>
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
<% } %>
<meta name="theme-color" content="<%= theme.color.navbar_bg_color %>">
<meta name="author" content="<%= page.author || config.author %>">
<meta name="keywords" content="<%= keywords %>">
<% if (theme.open_graph.enable) { %>
<%- open_graph(ogConfig) %>
<% } else { %>
<meta name="description" content="<%= description %>">
<% } %>
<% if ((theme.post.meta.views.enable && theme.post.meta.views.source === 'busuanzi')
|| (theme.footer.statistics.enable && theme.footer.statistics.source === 'busuanzi')) { %>
<meta name="referrer" content="no-referrer-when-downgrade">
<% } %>
<% if (theme.custom_head) { %>
<%- theme.custom_head %>
<% } %>
<title><%= title %></title>
<%- partial('_partials/css.ejs') %>
<%- export_config() %>
<%- js_ex(theme.static_prefix.internal_js, 'utils.js') %>
<%- js_ex(theme.static_prefix.internal_js, 'color-schema.js') %>
<%- partial('_partials/plugins/analytics.ejs') %>
<%- inject_point('head') %>
</head>