Files
blog/themes/Ying/layouts/partials/head.html
T
2026-05-20 14:33:05 +08:00

232 lines
7.8 KiB
HTML

<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>{{ .Title }}</title>
<!-- SEO & Meta Tags -->
<meta name="description" content="{{ if .IsHome }}{{ .Site.Params.description }}{{ else }}{{ .Description | default .Summary | plainify | truncate 160 }}{{ end }}" />
<link rel="canonical" href="{{ .RelPermalink | absURL }}" />
{{- $keywords := slice "大学" "教程" "blog" "优世界" "优设计" "博客" "大学生博客" "生活" "文案" -}}
{{- if .Params.tags -}}
{{- $keywords = .Params.tags -}}
{{- end -}}
{{- if .Params.keywords -}}
{{- $keywords = .Params.keywords -}}
{{- end -}}
<meta name="keywords" content="{{ delimit $keywords "," }}" />
<!-- Open Graph -->
<meta property="og:title" content="{{ .Title }}" />
<meta property="og:description" content="{{ if .IsHome }}{{ .Site.Params.description }}{{ else }}{{ .Description | default .Summary | plainify | truncate 160 }}{{ end }}" />
<meta property="og:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}" />
<meta property="og:url" content="{{ .Permalink }}" />
<meta property="og:site_name" content="{{ .Site.Title }}" />
{{- $image := .Site.Params.authorImage -}}
{{- if .Params.cover -}}
{{- $image = .Params.cover -}}
{{- end -}}
{{- if $image -}}
<meta property="og:image" content="{{ $image | absURL }}" />
<meta name="twitter:image" content="{{ $image | absURL }}" />
{{- end -}}
<!-- Twitter Card -->
<meta name="twitter:card" content="summary" />
<meta name="twitter:title" content="{{ .Title }}" />
<meta name="twitter:description" content="{{ if .IsHome }}{{ .Site.Params.description }}{{ else }}{{ .Description | default .Summary | plainify | truncate 160 }}{{ end }}" />
<!-- RSS Feed -->
<link rel="alternate" type="application/rss+xml" title="{{ site.Title }}" href="/rss.xml">
<!-- Favicon -->
<link rel="icon" type="image/x-icon" href="/favicon.ico">
<!-- Analytics -->
<script async src="https://019e3dec-3312-7873-862a-3f56ac99ea83.spst2.com/ustat.js"></script>
<script>
(function () {
try {
var theme = localStorage.getItem('theme');
if (!theme) {
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
theme = 'dark';
} else {
theme = 'light';
}
}
document.documentElement.setAttribute('data-theme', theme);
// Listen for system changes
if (window.matchMedia) {
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', event => {
// Only switch if user hasn't manually set a preference
// Or maybe we should respect system change if user hasn't explicitly locked it?
// Common behavior: manual override sticks.
if (!localStorage.getItem('theme')) {
var newTheme = event.matches ? "dark" : "light";
document.documentElement.setAttribute('data-theme', newTheme);
}
});
}
} catch (e) {}
})();
</script>
<!-- Preload Fonts -->
<link rel="preload" href="{{ "font/zql-v2.woff2" | relURL }}" as="font" type="font/woff2" crossorigin>
<link rel="preload" href="{{ "font/remixicon.woff2" | relURL }}" as="font" type="font/woff2" crossorigin>
<!-- Site Configuration -->
<script>
window.siteConfig = {
artalk: {
server: "{{ .Site.Params.artalk.server }}",
site: "{{ .Site.Params.artalk.site }}",
emoticons: "{{ .Site.Params.artalk.emoticons | absURL }}",
gravatar: "{{ .Site.Params.artalk.gravatar }}"
},
author: {
avatar: "{{ .Site.Params.author.avatar }}",
description: "{{ .Site.Params.author.description }}"
},
barrage: {
enableHitokoto: {{ .Site.Params.barrage.enableHitokoto | default true }},
hitokotoUrl: "{{ .Site.Params.barrage.hitokotoUrl }}"
}
};
</script>
<!-- Stylesheets -->
{{ $normalize := resources.Get "css/libs/normalize.css" }}
{{ $remixicon := resources.Get "css/libs/remixicon.css" }}
{{ $uikit := resources.Get "css/libs/uikit.min.css" }}
{{ $nprogress := resources.Get "css/libs/nprogress.min.css" }}
{{ $message := resources.Get "css/libs/message.min.css" }}
{{ $main := resources.Get "css/main.css" }}
{{ $style := slice $normalize $remixicon $uikit $nprogress $message $main | resources.Concat "css/style.css" | resources.Minify | resources.Fingerprint }}
{{ $artalk := resources.Get "css/libs/Artalk.css" | resources.Minify | resources.Fingerprint }}
<link rel="stylesheet" href="{{ $style.RelPermalink }}">
<link rel="stylesheet" href="{{ $artalk.RelPermalink }}">
{{- if and .Site.Params.style.enableBackgroundImage .Site.Params.style.backgroundImageUrl -}}
<style>
body, [data-theme="dark"] body {
background-image: url('{{ .Site.Params.style.backgroundImageUrl }}') !important;
background-size: {{ .Site.Params.style.backgroundSize | default "cover" }} !important;
background-repeat: {{ .Site.Params.style.backgroundRepeat | default "no-repeat" }} !important;
background-position: {{ .Site.Params.style.backgroundPosition | default "center" }} !important;
background-attachment: {{ .Site.Params.style.backgroundAttachment | default "fixed" }} !important;
}
</style>
{{- end -}}
<style>
@media only screen and (max-width: 768px) {
.items {
grid-template-columns: repeat(1, 1fr) !important;
grid-gap: 10px;
}
.link-des,.link-name{
right: 13px;
}
}
/* 新版友链样式 */
.items {
/* padding: 10px; */
width: 100%;
height: 100%;
/* background-color: #f5f5f6; */
display: grid;
grid-template-columns: repeat(2, 1fr);
grid-gap: 10px;
/* 网格之间的间距 */
justify-content: space-between;
}
.item-box {
background-color: white;
border-radius: 5px;
padding: 8px;
/* width: 47%; */
height: 300px;
/* border: 1px solid #333; */
box-shadow: rgba(14, 63, 126, 0.04) 0px 0px 0px 1px, rgba(42, 51, 69, 0.04) 0px 1px 1px -0.5px, rgba(42, 51, 70, 0.04) 0px 3px 3px -1.5px, rgba(42, 51, 70, 0.04) 0px 6px 6px -3px, rgba(14, 63, 126, 0.04) 0px 12px 12px -6px, rgba(14, 63, 126, 0.04) 0px 24px 24px -12px;
}
.website-img {
margin: 0 auto;
width: 90%;
}
.website-img img {
width: 100%;
height: 150px;
object-fit: contain;
}
.website-go-button {
margin: 0 auto;
width: 95%;
border-radius: 5px;
font-size: 14px;
padding: 5px;
text-align: center;
background-color: black;
color: white;
}
.link-info {
padding: 8px;
width: 100%;
height: 90px;
display: flex;
justify-content: center;
align-items: center;
}
.link-avatar {
width: 40%;
/* 设置弹性布局 */
display: flex;
/* justify-content: center; */
align-items: center;
}
.link-avatar img {
position: relative;
left: 5px;
width: 50px;
height: 50px;
}
.link-text-main {
width: 55%;
display: flex;
flex-direction: column;
}
.link-name {
position: relative;
right: 10px;
bottom: 5px;
width: 100%;
height: 50%;
font-weight: 600;
}
.link-des {
position: relative;
right: 10px;
top: 1px;
width: 100%;
height: 50%;
}
</style>
<!-- <script src="/js/jquery.min.js"></script> -->
<script src="/js/instantpage.min.js" type="module" defer></script>
<script>console.log("\n %c Amigo Theme %c https://usj.cc \n", "color: #fadfa3; background: #030307; padding:3px; font-size:12px;", "color: #ffffff;background: #16171a; padding: 3px; font-size: 12px;");</script>
<meta name="template" content="Amigo" />
</head>