mirror of
https://github.com/Noettore/cocoa-eh-hugo-theme.git
synced 2025-10-15 11:46:41 +02:00
Merge branch 'twitter_card' into dev
This commit is contained in:
16
README.md
16
README.md
@@ -44,6 +44,7 @@ complex website you can build it with the [Usage](#usage) section.
|
||||
* Logo and title in the header for a clear identity.
|
||||
* Possibility to have sections with a header and a list of articles.
|
||||
* Possibility to have single pages.
|
||||
* Twitter cards support
|
||||
|
||||
#### Differences from the original Cocoa
|
||||
|
||||
@@ -123,6 +124,21 @@ And call images in markdown like usual :
|
||||
|
||||
This will call the `./images/low/image.jpg` image and the `./images/high/image.jpg`.
|
||||
|
||||
#### Twitter cards
|
||||
|
||||
You can share your article on Twitter using the article link, and Twitter will show a summary card with the params of the post (`meta_img` is the image of the card) :
|
||||
|
||||
```
|
||||
title = "Test title"
|
||||
description = "Test description"
|
||||
meta_img = "./images/high/test.jpg"
|
||||
```
|
||||
|
||||
If you don't specify a meta image, it will take the global parameter `social_banner` in the `config.toml` :
|
||||
|
||||
```
|
||||
social_banner = "img/banner.png"
|
||||
```
|
||||
|
||||
## Changelog
|
||||
|
||||
|
@@ -26,4 +26,5 @@ lang = "en"
|
||||
github = "example"
|
||||
email = "you@example.com"
|
||||
linkedin = "john-example-aa80ue8è"
|
||||
twitter = "@example"
|
||||
twitter = "example"
|
||||
social_banner = "img/banner.png"
|
BIN
exampleSite/static/img/banner.png
Normal file
BIN
exampleSite/static/img/banner.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.8 KiB |
@@ -5,3 +5,15 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="referrer" content="no-referrer">
|
||||
{{ if .Site.Params.description }}<meta name="description" content="{{ .Site.Params.description }}">{{ end }}
|
||||
|
||||
{{ if .Site.Params.twitter }}
|
||||
<meta property="twitter:site" content="@{{.Site.Params.twitter}}">
|
||||
{{ end }}
|
||||
<meta property="twitter:title" content="{{ if .Title }}{{ .Title }}{{ else }}{{ .Site.Title }}{{ end }}">
|
||||
{{ if .Site.Params.social_banner }}
|
||||
<meta property="twitter:card" content="summary_large_image">
|
||||
<meta property="twitter:image" content="{{ if .Params.meta_img }}{{ .Site.BaseURL }}{{ .Params.meta_img }}{{ else }}{{ .Site.BaseURL }}{{.Site.Params.social_banner}}{{ end }}">
|
||||
{{ else }}
|
||||
<meta property="twitter:card" content="summary">
|
||||
{{ end }}
|
||||
<meta property="twitter:description" content="{{ if .IsHome }}{{ .Site.Params.description }}{{ else if .IsPage }}{{ .Description }}{{ end }}">
|
||||
|
Reference in New Issue
Block a user