Extract opengraph code into partial #16
2 changed files with 15 additions and 17 deletions
|
@ -9,23 +9,7 @@
|
||||||
{{ $style := resources.Get "/sass/custom.css" | resources.ToCSS $options | resources.Fingerprint }}
|
{{ $style := resources.Get "/sass/custom.css" | resources.ToCSS $options | resources.Fingerprint }}
|
||||||
<link rel="stylesheet" href="{{ $style.Permalink }}" integrity="{{ $style.Data.Integrity }}"/>
|
<link rel="stylesheet" href="{{ $style.Permalink }}" integrity="{{ $style.Data.Integrity }}"/>
|
||||||
|
|
||||||
<meta property="og:type" content="website"/>
|
{{ partial "opengraph.html" .}}
|
||||||
<meta property="og:site_name" content="{{ .Site.Title }}"/>
|
|
||||||
<meta property="og:title" content="{{ .Title }}"/>
|
|
||||||
<meta property="og:url" content="{{ .Permalink | absURL }}"/>
|
|
||||||
{{ $logoFile := printf "images/ogp/cosin_icon_%s.png" (string .Site.Data.cosin.date_year) }}
|
|
||||||
{{ $logo := "" }}
|
|
||||||
{{ with resources.Get $logoFile }}
|
|
||||||
{{ $logo = . }}
|
|
||||||
{{ else }}
|
|
||||||
{{ $logo = resources.Get "images/ogp/cosin_icon_generic.png" }}
|
|
||||||
{{ end }}
|
|
||||||
<meta property="og:image" content="{{ $logo.Permalink }}"/>
|
|
||||||
<meta property="og:image:type" content="{{ $logo.MediaType }}"/>
|
|
||||||
<meta property="og:image:width" content="{{ $logo.Width }}"/>
|
|
||||||
<meta property="og:image:height" content="{{ $logo.Height }}"/>
|
|
||||||
<meta property="og:image:alt" content="CoSin Icon {{ string .Site.Data.cosin.date_year }}"/>
|
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
14
layouts/partials/opengraph.html
Normal file
14
layouts/partials/opengraph.html
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
{{ $fileName := printf "images/ogp/cosin_icon_%s.png" (string .Site.Data.cosin.date_year) }}
|
||||||
|
{{ $logo := or (resources.Get $fileName) (resources.Get "images/ogp/cosin_icon_generic.png") }}
|
||||||
|
|
||||||
|
<meta property="og:type" content="website"/>
|
||||||
|
<meta property="og:site_name" content="{{ .Site.Title }}"/>
|
||||||
|
<meta property="og:title" content="{{ .Title }}"/>
|
||||||
|
<meta property="og:url" content="{{ .Permalink | absURL }}"/>
|
||||||
|
{{ with $logo }}
|
||||||
|
<meta property="og:image" content="{{ .Permalink }}"/>
|
||||||
|
<meta property="og:image:type" content="{{ .MediaType }}"/>
|
||||||
|
<meta property="og:image:width" content="{{ .Width }}"/>
|
||||||
|
<meta property="og:image:height" content="{{ .Height }}"/>
|
||||||
|
<meta property="og:image:alt" content="CoSin Icon {{ string $.Site.Data.cosin.date_year }}"/>
|
||||||
|
{{ end }}
|
Loading…
Reference in a new issue