diff options
| author | Eltrac <eltrac233@gmail.com> | 2024-11-28 23:02:16 +0800 |
|---|---|---|
| committer | Eltrac <eltrac233@gmail.com> | 2024-11-28 23:02:16 +0800 |
| commit | f9436cd426a04460bdae430956e7be8e9ff82458 (patch) | |
| tree | bd1ebce1fec2513ed4b499b26542efe2114e164d | |
| parent | 806c0fc59311d5c45ba12f94751724c5654841df (diff) | |
refactor(head): tidy head partial
| -rw-r--r-- | themes/yinyang/layouts/partials/head.html | 59 | ||||
| -rw-r--r-- | themes/yinyang/layouts/partials/head/css.html | 22 | ||||
| -rw-r--r-- | themes/yinyang/layouts/partials/head/seo.html (renamed from themes/yinyang/layouts/partials/seo.html) | 2 | ||||
| -rw-r--r-- | themes/yinyang/layouts/partials/head/siteinfo.html | 35 |
4 files changed, 63 insertions, 55 deletions
diff --git a/themes/yinyang/layouts/partials/head.html b/themes/yinyang/layouts/partials/head.html index 436ae93f..f51ed656 100644 --- a/themes/yinyang/layouts/partials/head.html +++ b/themes/yinyang/layouts/partials/head.html @@ -8,38 +8,9 @@ <meta property="og:url" content="{{ .Permalink }}" /> <link rel="canonical" href="{{ .Permalink }}" /> - {{- if .Site.Params.staticPrefix -}} - <link rel="dns-prefetch" href="{{ .Site.Params.staticPrefix }}" /> - {{- end -}} - - {{- if .Site.Params.favicon -}} - <link rel="apple-touch-icon" href="{{ .Site.Params.favicon }}" /> - <link rel="icon" href="{{ .Site.Params.favicon }}" /> - <link rel="shortcut" href="{{ .Site.Params.favicon }}" /> - {{- end -}} - <link rel="alternate" type="application/atom+xml" href="{{.Site.BaseURL}}index.xml" title="{{ .Site.Title }}"> - - {{ partial "seo" . }} - - {{- if .IsHome -}} - <title>{{ .Site.Title }}</title> - <meta property="og:title" content="{{ .Site.Title }}" /> - <meta property="og:type" content="website" /> - <meta property="og:description" content="{{ .Site.Params.description }}" /> - <meta name="description" content="{{ .Site.Params.description }}" /> - {{- else -}} - <title>{{ .Title }}</title> - <meta property="og:title" content="{{ .Title }}" /> - <meta property="og:type" content="article" /> - <meta property="og:description" content="{{ default .Summary .Description | plainify }}" /> - <meta name="description" content="{{ default .Summary .Description | plainify }}" /> - {{- end }} - <meta property="og:locale" content="{{ .Site.LanguageCode }}" /> - {{- if .Params.album -}} - <meta property="og:image" content="{{ .Params.album }}" /> - {{- else -}} - <meta property="og:image" content="{{ .Site.Params.favicon }}" /> - {{ end }} + <!-- SEO & Basic Meta Tags--> + {{ partial "head/seo" . }} + {{ partial "head/siteinfo" . }} <!-- Stylesheets --> {{ with resources.Get "css/index.css" | minify }} @@ -48,27 +19,7 @@ {{ with resources.Get "css/flexboxgrid-6.3.1.min.css" | minify }} <style>{{ .Content | safeCSS }}</style> {{ end }} - - <!-- waline --> - <link - rel="stylesheet" - href="https://unpkg.com/@waline/client@v3/dist/waline.css" - /> - - <!-- FancyBox --> - <script src="https://unpkg.com/@fancyapps/ui@5.0.36/dist/fancybox/fancybox.umd.js"></script> - <link - rel="stylesheet" - href="https://unpkg.com/@fancyapps/ui@5.0.36/dist/fancybox/fancybox.css" - /> - - {{ range .Site.Params.extraCSSFiles -}} - <link rel="stylesheet" href="{{ $.Site.Params.staticPrefix }}{{ . | relURL }}"> - {{- end }} - - <link href="{{ .Site.Params.staticPrefix }}{{ "index.xml" | relURL }}" rel="alternate" type="application/rss+xml" - title="{{ .Site.Title }}"> - {{ if .Site.Params.TwitterCards }}{{ template "_internal/twitter_cards.html" . }}{{ end }} + <!-- Extra head --> {{ .Site.Params.extraHead | safeHTML }} -</head> +</head>
\ No newline at end of file diff --git a/themes/yinyang/layouts/partials/head/css.html b/themes/yinyang/layouts/partials/head/css.html new file mode 100644 index 00000000..3dbc6427 --- /dev/null +++ b/themes/yinyang/layouts/partials/head/css.html @@ -0,0 +1,22 @@ +<!-- prefetches --> +{{- if .Site.Params.staticPrefix -}} +<link rel="dns-prefetch" href="{{ .Site.Params.staticPrefix }}" /> +{{- end -}} + +<!-- waline --> +<link +rel="stylesheet" +href="https://unpkg.com/@waline/client@v3/dist/waline.css" +/> + +<!-- FancyBox --> +<script src="https://unpkg.com/@fancyapps/ui@5.0.36/dist/fancybox/fancybox.umd.js"></script> +<link +rel="stylesheet" +href="https://unpkg.com/@fancyapps/ui@5.0.36/dist/fancybox/fancybox.css" +/> + +<!-- Extra --> +{{ range .Site.Params.extraCSSFiles -}} +<link rel="stylesheet" href="{{ $.Site.Params.staticPrefix }}{{ . | relURL }}"> +{{- end }}
\ No newline at end of file diff --git a/themes/yinyang/layouts/partials/seo.html b/themes/yinyang/layouts/partials/head/seo.html index 7cfe93c9..2d772d72 100644 --- a/themes/yinyang/layouts/partials/seo.html +++ b/themes/yinyang/layouts/partials/head/seo.html @@ -14,7 +14,7 @@ {{- else -}} "description" : "{{ default .Summary .Description | plainify }}", {{- end }} - "inLanguage" : "en-US", + "inLanguage" : "zh-CN", "author" : "{{ .Site.Author.name }}", "creator" : "{{ .Site.Author.name }}", "publisher": "{{ .Site.Author.name }}", diff --git a/themes/yinyang/layouts/partials/head/siteinfo.html b/themes/yinyang/layouts/partials/head/siteinfo.html new file mode 100644 index 00000000..90cd8214 --- /dev/null +++ b/themes/yinyang/layouts/partials/head/siteinfo.html @@ -0,0 +1,35 @@ +<!-- Basic site information --> +{{- if .IsHome -}} +<title>{{ .Site.Title }}</title> +<meta property="og:title" content="{{ .Site.Title }}" /> +<meta property="og:type" content="website" /> +<meta property="og:description" content="{{ .Site.Params.description }}" /> +<meta name="description" content="{{ .Site.Params.description }}" /> +{{- else -}} +<title>{{ .Title }}</title> +<meta property="og:title" content="{{ .Title }}" /> +<meta property="og:type" content="article" /> +<meta property="og:description" content="{{ default .Summary .Description | plainify }}" /> +<meta name="description" content="{{ default .Summary .Description | plainify }}" /> +{{- end }} +<meta property="og:locale" content="{{ .Site.LanguageCode }}" /> +{{- if .Params.album -}} +<meta property="og:image" content="{{ .Params.album }}" /> +{{- else -}} +<meta property="og:image" content="{{ .Site.Params.favicon }}" /> +{{ end }} + +<!-- Favicon --> +{{- if .Site.Params.favicon -}} +<link rel="apple-touch-icon" href="{{ .Site.Params.favicon }}" /> +<link rel="icon" href="{{ .Site.Params.favicon }}" /> +<link rel="shortcut" href="{{ .Site.Params.favicon }}" /> +{{- end -}} + +<!-- RSS --> +<link rel="alternate" type="application/atom+xml" href="{{.Site.BaseURL}}index.xml" title="{{ .Site.Title }}"> +<link href="{{ .Site.Params.staticPrefix }}{{ "index.xml" | relURL }}" rel="alternate" type="application/rss+xml" + title="{{ .Site.Title }}"> + +<!-- Twtter Card --> +{{ if .Site.Params.TwitterCards }}{{ template "_internal/twitter_cards.html" . }}{{ end }}
\ No newline at end of file |
