diff options
author | YunXiang Zhao <xiaohei.zyx@gmail.com> | 2020-04-30 12:03:36 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-30 12:03:36 +0300 |
commit | 5b9197f08c452c41d399adcbda394b78ac3308ac (patch) | |
tree | ae9664d1645a435b6836a2f7b0e76046ffeea485 | |
parent | 35e2c5be26767cceef06f47c5149757f8d9b411a (diff) | |
parent | 9493e3d4230e390eb3842852a2ff7a3c73a48782 (diff) |
Merge pull request #87 from xiao201261/patch-fix-head
delete multi head
-rw-r--r-- | layouts/_default/baseof.html | 2 | ||||
-rw-r--r-- | layouts/partials/head.html | 140 |
2 files changed, 68 insertions, 74 deletions
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 8088892..fe4fc67 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -1,8 +1,6 @@ <!DOCTYPE html> <html lang="{{ .Site.Language }}"> <head> - <meta charset="utf-8" /> - <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> <title> {{- block "title" . -}} {{ if .IsPage }} diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 88261db..0b7b4b2 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -1,77 +1,73 @@ -<head> - <meta charset="utf-8"> - <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> - <meta name="viewport" - content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui"> - <meta name="renderer" content="webkit"> - <meta http-equiv="Cache-Control" content="no-transform" /> - <meta http-equiv="Cache-Control" content="no-siteapp" /> - <meta name="apple-mobile-web-app-capable" content="yes"> - <meta name="apple-mobile-web-app-status-bar-style" content="black"> - <meta name="format-detection" content="telephone=no,email=no,adress=no"> - <!-- Color theme for statusbar --> - <meta name="theme-color" content="#000000" /> - <!-- 强制页面在当前窗口以独立页面显示,防止别人在框架里调用页面 --> - <meta http-equiv="window-target" content="_top" /> - <!-- baidu & google verification --> - {{ with .Site.Params.baiduVerification }} - <meta name="baidu-site-verification" content="{{.}}" />{{ end }} - {{ with .Site.Params.googleVerification }} - <meta name="google-site-verification" content="{{.}}" />{{ end }} - {{- if .Keywords -}} - {{ $length := len .Keywords | add -1 -}} - <meta name="keywords" - content="{{ range $index, $element := .Keywords }}{{ $element | safeHTML }}{{if ne $index $length }}, {{ end }}{{ end }}" /> - {{- else if .Site.Params.keywords -}} - {{ $length := len .Site.Params.keywords | add -1 -}} - <meta name="keywords" - content="{{ range $index, $element := .Site.Params.keywords }}{{ $element | safeHTML }}{{if ne $index $length }}, {{ end }}{{ end }}" /> - {{- end }} + <meta charset="utf-8"> + <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> + <meta name="viewport" + content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui"> + <meta name="renderer" content="webkit"> + <meta http-equiv="Cache-Control" content="no-transform" /> + <meta http-equiv="Cache-Control" content="no-siteapp" /> + <meta name="apple-mobile-web-app-capable" content="yes"> + <meta name="apple-mobile-web-app-status-bar-style" content="black"> + <meta name="format-detection" content="telephone=no,email=no,adress=no"> + <!-- Color theme for statusbar --> + <meta name="theme-color" content="#000000" /> + <!-- 强制页面在当前窗口以独立页面显示,防止别人在框架里调用页面 --> + <meta http-equiv="window-target" content="_top" /> + <!-- baidu & google verification --> + {{ with .Site.Params.baiduVerification }} + <meta name="baidu-site-verification" content="{{.}}" />{{ end }} + {{ with .Site.Params.googleVerification }} + <meta name="google-site-verification" content="{{.}}" />{{ end }} + {{- if .Keywords -}} + {{ $length := len .Keywords | add -1 -}} + <meta name="keywords" + content="{{ range $index, $element := .Keywords }}{{ $element | safeHTML }}{{if ne $index $length }}, {{ end }}{{ end }}" /> + {{- else if .Site.Params.keywords -}} + {{ $length := len .Site.Params.keywords | add -1 -}} + <meta name="keywords" + content="{{ range $index, $element := .Site.Params.keywords }}{{ $element | safeHTML }}{{if ne $index $length }}, {{ end }}{{ end }}" /> + {{- end }} - {{- if .Description -}} - <meta name="description" content="{{ .Description | safeHTML }}" /> - {{- else if .IsPage -}} - <meta name="description" content="{{ .Summary | plainify }}" /> - {{- else if .Site.Params.description -}} - <meta name="description" content="{{ .Site.Params.description | safeHTML }}" /> - {{- end -}} - - - - <!-- Site Generator --> - <meta name="generator" content="Hugo {{ .Site.Hugo.Version }} with theme pure" /> - <title> - {{- block "title" . -}} - {{ if .IsPage }}{{ .Title }} - {{ .Site.Title }}{{ else }}{{ .Site.Title }}{{ end }} + {{- if .Description -}} + <meta name="description" content="{{ .Description | safeHTML }}" /> + {{- else if .IsPage -}} + <meta name="description" content="{{ .Summary | plainify }}" /> + {{- else if .Site.Params.description -}} + <meta name="description" content="{{ .Site.Params.description | safeHTML }}" /> {{- end -}} - </title> - <!-- Canonical links --> - {{ range .AlternativeOutputFormats -}} - {{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }} - {{ end -}} - {{ $css := resources.Get "css/style.css" | minify | fingerprint}} - <link rel="stylesheet" href="{{ $css.Permalink }}"> - {{ with .Site.Params.customCSS }} - <link rel="stylesheet" href="{{ . | absURL }}" async>{{ end }} - <link rel="stylesheet" href="https://cdn.staticfile.org/highlight.js/9.15.10/styles/github.min.css" async> - {{- if eq .Site.Params.comment.type "gitalk"}} - <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.css" async> - {{- end }} - <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tocbot/4.4.2/tocbot.css" async> - {{/* NOTE: These Hugo Internal Templates can be found starting at https://github.com/spf13/hugo/blob/master/tpl/tplimpl/template_embedded.go#L158 */}} - {{- template "_internal/opengraph.html" . -}} - {{- template "_internal/google_news.html" . -}} - {{- template "_internal/schema.html" . -}} - {{- template "_internal/twitter_cards.html" . -}} - <!-- Polyfill for old browsers --> - {{ `<!--[if lte IE 9]> - <script src="https://cdnjs.cloudflare.com/ajax/libs/classlist/1.1.20170427/classList.min.js"></script> - <![endif]-->` | safeHTML }} - {{ `<!--[if lt IE 9]> - <script src="https://cdn.jsdelivr.net/npm/html5shiv@3.7.3/dist/html5shiv.min.js"></script> - <script src="https://cdn.jsdelivr.net/npm/respond.js@1.4.2/dest/respond.min.js"></script> - <![endif]-->` | safeHTML }} + <!-- Site Generator --> + <meta name="generator" content="Hugo {{ .Site.Hugo.Version }} with theme pure" /> + <title> + {{- block "title" . -}} + {{ if .IsPage }}{{ .Title }} - {{ .Site.Title }}{{ else }}{{ .Site.Title }}{{ end }} + {{- end -}} + </title> + <!-- Canonical links --> + {{ range .AlternativeOutputFormats -}} + {{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }} + {{ end -}} + {{ $css := resources.Get "css/style.css" | minify | fingerprint}} + <link rel="stylesheet" href="{{ $css.Permalink }}"> + {{ with .Site.Params.customCSS }} + <link rel="stylesheet" href="{{ . | absURL }}" async>{{ end }} + <link rel="stylesheet" href="https://cdn.staticfile.org/highlight.js/9.15.10/styles/github.min.css" async> + {{- if eq .Site.Params.comment.type "gitalk"}} + <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.css" async> + {{- end }} + <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tocbot/4.4.2/tocbot.css" async> + {{/* NOTE: These Hugo Internal Templates can be found starting at https://github.com/spf13/hugo/blob/master/tpl/tplimpl/template_embedded.go#L158 */}} + {{- template "_internal/opengraph.html" . -}} + {{- template "_internal/google_news.html" . -}} + {{- template "_internal/schema.html" . -}} + {{- template "_internal/twitter_cards.html" . -}} + + <!-- Polyfill for old browsers --> + {{ `<!--[if lte IE 9]> + <script src="https://cdnjs.cloudflare.com/ajax/libs/classlist/1.1.20170427/classList.min.js"></script> + <![endif]-->` | safeHTML }} -</head>
\ No newline at end of file + {{ `<!--[if lt IE 9]> + <script src="https://cdn.jsdelivr.net/npm/html5shiv@3.7.3/dist/html5shiv.min.js"></script> + <script src="https://cdn.jsdelivr.net/npm/respond.js@1.4.2/dest/respond.min.js"></script> + <![endif]-->` | safeHTML }}
\ No newline at end of file |