You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

132 lines
5.1 KiB

{{ if or .Params.author .Site.Author.name }} {{/* author */}}
<meta name="author" content="{{- or .Params.author .Site.Author.name -}}">
{{ end }}
{{ $title := .Site.Title }}
{{ if .IsHome }}
{{ if .Params.Title }}
{{ $title = printf "%s" .Params.Title }}
{{ end }}
<title>{{ $title }}</title>
{{ else }}
{{ with .Params.Title }}
{{ $title = printf "%s 🌟 %s" . $title }}
{{ end }}
<title>{{ $title }}</title>
{{ end }}
{{ if or .Keywords .Site.Params.keywords }} {{/* keywords */}}
{{ $keywords := slice }}
{{ with .Params.keywords }}
{{ $keywords = . }}
{{ else }}
{{ with .Site.Params.keywords }}
{{ $keywords = . }}
{{ end }}
{{ end }}
<meta name="keywords" content="{{ range $index, $value := $keywords }}{{ if gt $index 0 }},{{ end }}{{ $value }}{{ end }}">
{{ end }}
{{ if or .Description .Site.Params.description }} {{/* description*/}}
<meta name="description" content="{{ with .Description }}{{ . }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}">
{{ end }}
<meta property="og:locale" content="zh_CN">
<!-- Twitter Card -->
<meta name="twitter:card" content="summary" />
{{ with $.Site.Params.Twitter.site }}
<meta name="twitter:site" content="{{ $.Site.Params.Twitter.site }}" />
{{ end }}
{{ with $.Site.Params.Twitter.creator }}
<meta name="twitter:creator" content="{{ if $.IsHome }}{{ $.Site.Params.Twitter.creator }}{{ else if isset $.Params "authortwitter" }}{{ $.Params.authorTwitter }}{{ else }}{{ $.Params.Author }}{{ end }}" />
{{ end }}
{{ if .IsHome }}
<meta property="og:type" content="website" />
{{ else }}
<meta property="og:type" content="article" />
{{ end }}
<meta property="og:title" content="{{ $title }}">
<meta property="og:description" content="{{ if .IsHome }}{{ with .Description }}{{ . }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ else if .Description}}{{ .Description | plainify }}{{ else }}{{ .Summary | plainify }}{{ end }}" />
<meta property="og:url" content="{{ .Permalink }}" />
<meta property="og:site_name" content="{{ $.Site.Title }}" />
{{ if isset .Params "cover" }}
{{ if eq "index.md" $.Page.File.LogicalName }}
<meta property="og:image" content="{{ printf "%s%s" .Permalink .Params.cover }}">
{{ else }}
<meta property="og:image" content="{{ .Param "cover" | absURL }}">
{{ end }}
{{ else }}
{{ with (index (.Resources.ByType "image") 0) }}
<meta property="og:image" content="{{ .Permalink }}">
{{ end }}
{{ end }}
<meta property="og:image:width" content="2048">
<meta property="og:image:height" content="1024">
{{- $iso8601 := "2006-01-02T15:04:05+08:00" -}}
<meta property="article:section" content="{{ .Section }}" />
{{ with .PublishDate }}<meta property="article:published_time" {{ .Format $iso8601 | printf "content=%q" | safeHTMLAttr }} />{{ end }}
{{ with .Lastmod }}<meta property="article:modified_time" {{ .Format $iso8601 | printf "content=%q" | safeHTMLAttr }} />{{ end }}
{{- with .Params.audio }}<meta property="og:audio" content="{{ . }}" />{{ end }}
{{- with .Params.locale }}<meta property="og:locale" content="{{ . }}" />{{ end }}
{{- with .Site.Params.title }}<meta property="og:site_name" content="{{ . }}" />{{ end }}
{{- with .Params.videos }}{{- range . }}
<meta property="og:video" content="{{ . | absURL }}" />
{{ end }}{{ end }}
{{ if .Params.articleSchemaImages }}
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "NewsArticle",
"headline": "{{- $title -}}",
"image": {{ .Params.articleSchemaImages }},
"datePublished": {{ .PublishDate.Format "2006-01-02T15:04:05+08:00" | safeHTMLAttr }},
"dateModified": {{ .Lastmod.Format "2006-01-02T15:04:05+08:00" | safeHTMLAttr }},
"author": [{
"@type":"Organization",
"name": "奈飞365",
"url": {{ .Site.BaseURL | safeHTMLAttr }}
}]
}
</script>
{{ end }}
{{ with .Params.diySchema -}}
<script type="application/ld+json">{{- . -}}</script>
{{end -}}
{{ $RatingSchema := .Params.ratingSchema }}
{{with $RatingSchema}}
<link href="/libs/fontawesome/css/all.min.css" rel="stylesheet">
{{ if eq .type "SoftwareApplication"}}
<script type="application/ld+json">{
"@context": "https://schema.org",
"@type": "SoftwareApplication",
"name": "{{ $title }}",
"operatingSystem": "{{- .operatingSystem -}}",
"applicationCategory": "{{- .applicationCategory -}}",
"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": "{{.ratingValue}}",
"bestRating": "5",
"ratingCount": "{{.ratingCount}}"
},
"offers": {
"@type": "Offer",
"price": "0",
"priceCurrency": "CNY"
}
}</script>
{{ else }}
<script type="application/ld+json">{
"@context": "https://schema.org/",
"@type": "CreativeWorkSeries",
"name": "{{ $title }}",
"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": "{{.ratingValue}}",
"bestRating": "5",
"ratingCount": "{{.ratingCount}}"
}
}</script>
{{- end -}}
{{- end -}}