Use page assets for ogp template
This commit is contained in:
parent
2429e19bee
commit
984b3b2c1c
7 changed files with 11 additions and 4 deletions
assets/images/ogp
cosin_icon_2018.pngcosin_icon_2019.pngcosin_icon_2020.pngcosin_icon_2021.pngcosin_icon_2024.pngcosin_icon_generic.png
layouts/_default
Before ![]() (image error) Size: 19 KiB After ![]() (image error) Size: 19 KiB ![]() ![]() |
Before ![]() (image error) Size: 17 KiB After ![]() (image error) Size: 17 KiB ![]() ![]() |
Before ![]() (image error) Size: 50 KiB After ![]() (image error) Size: 50 KiB ![]() ![]() |
Before ![]() (image error) Size: 50 KiB After ![]() (image error) Size: 50 KiB ![]() ![]() |
Before ![]() (image error) Size: 18 KiB After ![]() (image error) Size: 18 KiB ![]() ![]() |
BIN
assets/images/ogp/cosin_icon_generic.png
Normal file
BIN
assets/images/ogp/cosin_icon_generic.png
Normal file
Binary file not shown.
After ![]() (image error) Size: 8.9 KiB |
|
@ -13,10 +13,17 @@
|
|||
<meta property="og:site_name" content="{{ .Site.Title }}"/>
|
||||
<meta property="og:title" content="{{ .Title }}"/>
|
||||
<meta property="og:url" content="{{ .Permalink | absURL }}"/>
|
||||
<meta property="og:image" content="{{ printf "images/ogp/cosin_icon_%s.png" (string .Site.Data.cosin.date_year) | absURL }}"/>
|
||||
<meta property="og:image:type" content="image/png"/>
|
||||
<meta property="og:image:width" content="128"/>
|
||||
<meta property="og:image:height" content="128"/>
|
||||
{{ $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 | absURL }}"/>
|
||||
<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>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue