diff options
author | Joway.CI <joway.w@gmail.com> | 2020-03-03 08:40:32 +0300 |
---|---|---|
committer | Joway.CI <joway.w@gmail.com> | 2020-03-03 08:40:32 +0300 |
commit | b5cfdc32b764e7b76d76be737b85d4a1b4f65b1d (patch) | |
tree | 9123c5a2aa6d5240eeb93248a3f0d2b2f4ac8f44 | |
parent | 4c69ebd35eb6205ad77f43eb73d4ce2ab794e73d (diff) |
feat: support Open Graph
-rw-r--r-- | layouts/index.html | 2 | ||||
-rw-r--r-- | layouts/partials/head.html | 20 |
2 files changed, 16 insertions, 6 deletions
diff --git a/layouts/index.html b/layouts/index.html index 519f63d..80ef6a7 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -1,5 +1,5 @@ <!DOCTYPE html> -<html lang="en"> +<html lang="{{ .Site.LanguageCode }}" prefix="og: http://ogp.me/ns#"> {{ partial "head.html" . }} <body> diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 86d1dd0..c04cf9f 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -8,30 +8,40 @@ <meta property="og:url" content="{{ .Permalink }}" /> <link rel="canonical" href="{{ .Permalink }}" /> {{- if .Site.Params.favicon -}} - <link rel="shortcut icon" href="{{ .Site.Params.favicon }}" type="image/x-png" /> + <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 }} - {{ .Site.Title }}</title> <meta property="og:title" content="{{ .Title }} - {{ .Site.Title }}" /> <meta property="og:type" content="article" /> + <meta property="og:description" content="{{ default .Summary .Description }}" /> <meta name="description" content="{{ default .Summary .Description }}" /> {{- end }} + <meta property="og:locale" content="{{ .Site.LanguageCode }}" /> + {{- if .Params.album -}} + <meta property="og:image" content="{{ .Params.album }}" /> + {{ end }} <link rel="stylesheet" href="{{ .Site.Params.staticPrefix }}{{ "css/flexboxgrid-6.3.1.min.css" | relURL }}" /> {{ if not .IsHome -}} - <link rel="stylesheet" - href="{{ .Site.Params.staticPrefix }}{{ "css/github-markdown.min.css" | relURL }}" /> + <link rel="stylesheet" href="{{ .Site.Params.staticPrefix }}{{ "css/github-markdown.min.css" | relURL }}" /> <link rel="stylesheet" href="{{ .Site.Params.staticPrefix }}{{ "css/highlight/tomorrow.min.css" | relURL }}" /> {{- end }} <link rel="stylesheet" href="{{ "css/index.css" | relURL }}"> - <link href="{{ .Site.Params.staticPrefix }}{{ "index.xml" | relURL }}" rel="alternate" type="application/rss+xml" title="{{ .Site.Title }}"> + <link href="{{ .Site.Params.staticPrefix }}{{ "index.xml" | relURL }}" rel="alternate" type="application/rss+xml" + title="{{ .Site.Title }}"> <!-- fonts --> <link href="https://fonts.googleapis.com/css?family=Arvo|Permanent+Marker" rel="stylesheet"> <!-- quicklink require --> @@ -43,4 +53,4 @@ </script> --> {{ .Site.Params.extraHead | safeHTML }} -</head> +</head>
\ No newline at end of file |